You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code should light the onboard LED when the button is pressed because we're creating an InputPort that listens to the ONBOARD_BTN pin, however, it actually resets the board:
using System;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware.Netduino;namespaceOnboardButtonAndLed{publicclassProgram{// An output port allows you to write (send a signal) to a pinstaticOutputPort_led=new OutputPort(Pins.ONBOARD_LED,false);// An input port reads the signal from a pinstaticInputPort_button=new InputPort(Pins.ONBOARD_BTN,false, Port.ResistorMode.Disabled);staticbool_buttonPressed=false;publicstaticvoidMain(){// turn the LED off initially
_led.Write(false);// run foreverwhile(true){// set the onboard LED output to be the input of the button
_led.Write(_button.Read());}}}}
however, if I create the onboard button this way, it works:
The following code should light the onboard LED when the button is pressed because we're creating an
InputPort
that listens to the ONBOARD_BTN pin, however, it actually resets the board:however, if I create the onboard button this way, it works:
Evidently, this was fixed in an earlier firmware version, but regressed: http://forums.netduino.com/index.php?/topic/11844-newbie-onboard-button-in-a-program/
The text was updated successfully, but these errors were encountered: