Control 2 leds blinking pattern with a button push
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
namespace NetduinoPlusApplication1
{
public class Program
{
public static void Main()
{
OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
OutputPort blu_led = new OutputPort(Pins.GPIO_PIN_D0, false);
InputPort button = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled);
bool buttonState = false;
while (true)
{
buttonState = button.Read();
Debug.Print(buttonState.ToString());
led.Write(buttonState);
blu_led.Write(!buttonState);
Thread.Sleep(500);
led.Write(!buttonState);
blu_led.Write(buttonState);
Thread.Sleep(250);
}
}
}
}