[font="'lucida sans unicode', 'lucida grande', sans-serif;"]Hello![/font]
[font="'lucida sans unicode', 'lucida grande', sans-serif;"]After successfully restoring my Netduino, see http://forums.netdui...ond/#entry51353 for further details; I then turned towards confirming that all of the other well known applications to work, I then selected the regular button one. The button worn on the regular unchanged Netduino model 1 is in fact advertised in the catalogs for its parts happens to be a normally-open style. However when running the unchanged button code it behaves as a normally-closed one. Here:[/font]
using System;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino;/* NOTE: make sure you change the deployment target from the Emulator to your Netduino before running this * Netduino sample app. To do this, select "Project menu > ButtonApp Properties > .NET Micro Framework" and * then change the Transport type to USB. Finally, close the ButtonApp properties tab to save these settings. */namespace ButtonApp{ public class Program { public static void Main() { // write your code here OutputPort led = new OutputPort(Pins.ONBOARD_LED, true); InputPort button = new InputPort(Pins.ONBOARD_SW1, true, Port.ResistorMode.Disabled); bool buttonState = true; while (true) { buttonState = button.Read(); led.Write(!buttonState); } } }}
[font="'lucida sans unicode', 'lucida grande', sans-serif;"]I say unchanged because as it happens naturally I loaded it into my regular IDE for this, VS2010 Express, the C Sharp one, and told the system to go off and run it. In fact this is my second-go-round with the program as I've just returned to the family and am pursuing a more complicated application. I decided to try out the examples. [/font]
[font="'lucida sans unicode', 'lucida grande', sans-serif;"]Upon reading the description of the code in the book that's supposed to travel with these Netduinos, it is the use of the bang, or exclamation point as a not operator has the button state being interpreted that way. Nice![/font]