Can Anyone Help with Error "An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll "
#1
Posted 10 March 2011 - 03:06 PM
#2
Posted 10 March 2011 - 03:10 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#3
Posted 10 March 2011 - 03:12 PM
#4
Posted 10 March 2011 - 03:19 PM
Thread.Sleep(10 / 1000);You could just as well type:
Thread.Sleep(0.01);It will be rounded down, so it actually does:
Thread.Sleep(0);
This, since Thread.Sleep requires an integer (int millisecondsTimeout) as parameter, 0.01 is not an integer number.
On which line occures the error?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#5
Posted 10 March 2011 - 03:27 PM
#6
Posted 10 March 2011 - 03:34 PM
OutputPort op1 = new OutputPort(Pins.GPIO_PIN_D0, false); OutputPort op2 = new OutputPort(Pins.GPIO_PIN_D0, false);Fixed it by doing this:
OutputPort op1 = new OutputPort(Pins.GPIO_PIN_D0, false); op1.Dispose(); OutputPort op2 = new OutputPort(Pins.GPIO_PIN_D0, false);
I think the reference to the pin still existed so it gave the error. I'm no expert myself, but you should try to dispose the ports at the end of the functions "reverse" etc.
You could also consider to make your output ports global in your class.
Besides that, I'm curious of what you would like to do with a Thread.Sleep(0); (since that's what it actually does at that point, not 0.01)
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#7
Posted 10 March 2011 - 03:50 PM
if (true) //Begin Infinate while loop {I think you mean:
while (true) //Begin Infinate while loop {
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#8
Posted 10 March 2011 - 03:53 PM
#9
Posted 10 March 2011 - 03:55 PM
#10
Posted 10 March 2011 - 04:10 PM
static OutputPort leftMF = new OutputPort(Pins.GPIO_PIN_D0, false); // Initially off static OutputPort leftMR = new OutputPort(Pins.GPIO_PIN_D1, false); static OutputPort rightMF = new OutputPort(Pins.GPIO_PIN_D2, false); static OutputPort rightMR = new OutputPort(Pins.GPIO_PIN_D8, false); static void forward() { leftMF.Write(true); leftMR.Write(false); rightMF.Write(true); rightMR.Write(false); } static void reverse() { leftMF.Write(false); leftMR.Write(true); rightMF.Write(false); rightMR.Write(true); } // Similarly for turnLeft, turnRight...
#11
Posted 18 March 2011 - 08:08 AM
Hi
I have this error when trying to build and send to my Netduino "An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll"
Can anyone help or suggest why? I'm fairly new to this so any help would be appreciated. If the code is needed I can upload.
Thanks
Danny
I had the same error tonight on almost the same code. I checked the firmware level of my board and it was 4.1.0. Upgraded to 4.1.0.6 and the error went away.
Worth a look.
Mike.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users