The netduino GO! Button module is a single button. The button class has three features, the pressed and released events, and the ButtonState property.
Here is a quick video I (
Omar) made to show what can be done with it and how:
Sample Code:
using System.Threading;
namespace NetduinoGo_Test
{
public class Program
{
static NetduinoGo.RgbLed led = new NetduinoGo.RgbLed();
static NetduinoGo.Button button = new NetduinoGo.Button();
public static void Main()
{
led.SetColor(0, 0, 0);
button.ButtonPressed += new NetduinoGo.Button.ButtonEventHandler(button_ButtonPressed);
button.ButtonReleased += new NetduinoGo.Button.ButtonEventHandler(button_ButtonReleased);
Thread.Sleep(Timeout.Infinite);
// Or for the same behavior with no events, use the code below.
//while (!button.ButtonState)
//{
// // wait!
//}
//while (true)
//{
// if (button.ButtonState)
// led.SetColor(0, 255, 0);
// else
// led.SetColor(255, 0, 0);
//}
}
static void button_ButtonReleased(object sender, bool buttonState)
{
led.SetColor(0, 255, 0);
}
static void button_ButtonPressed(object sender, bool buttonState)
{
led.SetColor(255, 0, 0);
}
}
}
Where to buy: