Controlling an LED with a switch using the original Netduino. Repository created for educational purposes.
Software:
Parts:
- Netduino 1
- Two 220Ω Resistors
- One LED
- One Standard Breadboard
- Seven Wires
- One Switch
var led = new OutputPort(Pins.GPIO_PIN_D13, false);
var button = new InputPort(Pins.GPIO_PIN_D2, false, Port.ResistorMode.Disabled);
while (true)
{
if (!button.Read())
{
led.Write(!led.Read());
Thread.Sleep(1000);
}
}