Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Request For Help In Running C# Programs With 4.2.2

Netduinogo 4.2.2

Best Answer Gutworks, 19 January 2013 - 05:01 AM

This is the code:  ( i do not have onboard led choice)

 

 

// write your code here
            OutputPort led = new OutputPort((Cpu.Pin)22, false);
            while (true)
            {
                led.Write(true); // turn on the LED
                Thread.Sleep(250); // sleep for 250ms
                led.Write(false); // turn off the led
                Thread.Sleep(250); // sleep for 250 ms
 
 
            } 
 
Thank you for your help.

Hi Denisetoo,

 

I don't think your code sample will work using OutputPort led = new OutputPort((Cpu.Pin)22, false);

Generally the correct way to access the onboard led is to use Pins.ONBOARD_LED. When you first start typing the Pins class as an argument, Intellisense should give you a list of available options, one of which being the ONBOARD_LED. 

 

With that said, this unfortunately will still not work as the blue leds beside each port, are reserved at the moment and until a future update cannot be blinked unlike the ONBOARD_LED of the other Netduino boards. There are a couple of ways around this, but it's a bit of a hack. 

 

However I do have some good news; you can access the white PowerLed :)

 

To do so you use this declare you led like so:

 

OutputPort led = new OutputPort(Pins.PowerLed, false);

The rest of your code should remain the same. 

 

P.S. One little interesting trick with the latest shield base autodetect firmware is that if you connect a Shield Base to a port you'll notice that you now can use OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); and the blue Goport LED will blink :)

 

Cheers,

Steve

Go to the full post


  • Please log in to reply
10 replies to this topic

#1 Denisetoo

Denisetoo

    Member

  • Members
  • PipPip
  • 22 posts

Posted 16 January 2013 - 10:52 PM

I updated my netduingo to 4.2.2.  Before I updated I was able to run the program to blink the onboard led on the netduinogo.  Now I get these errors: "The debugging target is not in an initialized state; rebooting...."

 

After a about five to ten minutes I get this in the Visual C# output window:

 

"Incrementally deploying assemblies to device

Deploying assemblies for a total size of 1796 bytes
Assemblies successfully deployed to device.
The debugging target and the debugger engine failed to initialize because of unspecified device errors.
The debugger engine thread has terminated unexpectedly with error 'Could not reconnect to the debugging target after rebooting it.'."
 
When I move unplug the USB connector and replug it, the software is not downloaded to the netduinogo as it did before I downloaded 4.2.2. I have used the steps:
 
change the USB to serial, back to serial.  I still get these errors.
 
Any ideas on how I may correct this?
 


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 January 2013 - 03:37 AM

Hi Denisetoo, Try erasing the current app using MFDeploy. Then unplug and re-attach your Netduino Go. And then go ahead and try deploying one more time. Also...which LED are you trying to blink on your Netduino Go? You can go ahead and blink the power LED...but GoBus assumes control of all the blue GoPort LEDs by default. There was a bug in the older firmware which would accidentally let those "Pins" be oversubscribed--but you should get the proper exception with the latest firmware. If you remove the "SecretLabs.NETMF.Hardware.NetduinoGo.dll" and "GoBus.dll" references from your project, you should be able to access the LEDs directly for a blinky app. BTW, we have plans for a set of methods which will let you control the LEDs from code--while GoBus is also running. Chris

#3 Denisetoo

Denisetoo

    Member

  • Members
  • PipPip
  • 22 posts

Posted 18 January 2013 - 10:06 PM

Hello Chris,

 

Which should I erase?  I am learning how to post better to the forum.  I have attached a file.  Next I will use Mozilla.



#4 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 18 January 2013 - 10:24 PM

Hello Chris,

 

Which should I erase?  I am learning how to post better to the forum.  I have attached a file.  Next I will use Mozilla.

 

Chris is referring to using the MFDeploy application to erase your program from the Netduino.  Power down and power up the Netduino and redeploy.



#5 Denisetoo

Denisetoo

    Member

  • Members
  • PipPip
  • 22 posts

Posted 18 January 2013 - 10:51 PM

Thank you Dave.  I purchased my first netduino a few weeks ago.  I am on a learning curve.  The first time I tried to erase, it gave me two checkboxes, one for deployment.  I clicked that and erased it.  I wish I know what I am doing wrong.

 

The netduingo gets stuck in "the target is not in an initalized state, rebooting..."

 

After five mins or more i get this error in the output window :

Deploying assemblies for a total size of 4204 bytes
Assemblies successfully deployed to device.
The debugging target and the debugger engine failed to initialize because of unspecified device errors.
The debugger engine thread has terminated unexpectedly with error 'Could not reconnect to the debugging target after rebooting it.'.
 

 

I had this error before I added 4.2.2 and other stuff I do not remember.  But when I unplugged and plugged the USB connector, the firmware is in the netduinogo and the onboard led blinked.  I was able to get the go LED, potentiometer and push button to work with previous NET. I erased the deployment.

 

This is the code:  ( i do not have onboard led choice)

// write your code here
            OutputPort led = new OutputPort((Cpu.Pin)22, false);
            while (true)
            {
                led.Write(true); // turn on the LED
                Thread.Sleep(250); // sleep for 250ms
                led.Write(false); // turn off the led
                Thread.Sleep(250); // sleep for 250 ms
 
 
            } 
 
Thank you for your help.

 



#6 Denisetoo

Denisetoo

    Member

  • Members
  • PipPip
  • 22 posts

Posted 18 January 2013 - 11:48 PM

When I ping netduinogo in MFDeploy this is all I get:  

 

All I get is

 

"Pinging ...TinyCLR "

 

Is this correct?



#7 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 19 January 2013 - 12:48 AM

Yes, If you select device capability it will show the firmware that is loaded.

 

Chuck



#8 Denisetoo

Denisetoo

    Member

  • Members
  • PipPip
  • 22 posts

Posted 19 January 2013 - 01:12 AM

Thanks Chuck.  I need to find out why Visual C# express cannot connect to netduingo after rebooting it.



#9 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 19 January 2013 - 05:01 AM   Best Answer

This is the code:  ( i do not have onboard led choice)

 

 

// write your code here
            OutputPort led = new OutputPort((Cpu.Pin)22, false);
            while (true)
            {
                led.Write(true); // turn on the LED
                Thread.Sleep(250); // sleep for 250ms
                led.Write(false); // turn off the led
                Thread.Sleep(250); // sleep for 250 ms
 
 
            } 
 
Thank you for your help.

Hi Denisetoo,

 

I don't think your code sample will work using OutputPort led = new OutputPort((Cpu.Pin)22, false);

Generally the correct way to access the onboard led is to use Pins.ONBOARD_LED. When you first start typing the Pins class as an argument, Intellisense should give you a list of available options, one of which being the ONBOARD_LED. 

 

With that said, this unfortunately will still not work as the blue leds beside each port, are reserved at the moment and until a future update cannot be blinked unlike the ONBOARD_LED of the other Netduino boards. There are a couple of ways around this, but it's a bit of a hack. 

 

However I do have some good news; you can access the white PowerLed :)

 

To do so you use this declare you led like so:

 

OutputPort led = new OutputPort(Pins.PowerLed, false);

The rest of your code should remain the same. 

 

P.S. One little interesting trick with the latest shield base autodetect firmware is that if you connect a Shield Base to a port you'll notice that you now can use OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); and the blue Goport LED will blink :)

 

Cheers,

Steve



#10 Denisetoo

Denisetoo

    Member

  • Members
  • PipPip
  • 22 posts

Posted 19 January 2013 - 02:02 PM

Thank you so much Steve!  Your solution worked.  



#11 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 19 January 2013 - 02:17 PM

Awesome! Good to hear that your hacking away :)







Also tagged with one or more of these keywords: Netduinogo, 4.2.2

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.