- Install the Netduino v4.2 SDK.
- Create a new "Netduino Go" project.
- Add the references for the go!modules you'd like to use (NetduinoGo.Button.dll, Nwazet.Relay.dll, etc.) using the "Add References..." dialog.
Here's an example on how to use a Netduino Go Button module:
NetduinoGo.Button button = new NetduinoGo.Button(); // find first available button
button.ButtonReleased += new NetduinoGo.Button.ButtonEventHandler(button_ButtonReleased);
static void button_ButtonReleased(object sender, bool buttonState)
{
Debug.Print("Button has been released.");
}
If you have multiple buttons, or you'd like to specify the socket used by a button:
// use the Netduino Go Button on socket 5 NetduinoGo.Button button = new NetduinoGo.Button(GoSockets.Socket5);
Advanced users: you can also cast an int to specify a socket...although using the GoSockets.Socket# method is cleaner.
// use the Netduino Go button on socket 5 -- casted NetduinoGo.Button button = new NetduinoGo.Button((GoBus.GoSocket)5);
To use an RgbLed module, you'll simply create an instance and then set its color.
NetduinoGo.RgbLed rgbLed = new NetduinoGo.RgbLed(); // change the color to orange. rgbLed.SetColor(255, 40, 0);
To use a Potentiometer module...
NetduinoGo.Potentiometer pot = new NetduinoGo.Potentiometer();
// read the pot's value
while (true)
{
Debug.Print("value: " + pot.GetValue().ToString());
System.Threading.Thread.Sleep(50);
}
The Shield Base is currently in beta, and temporarily requires use of an entire go!bus channel. You can plug it into any socket--but you'll need to keep all other modules on that channel free for the moment (first channel = sockets 1-4; second channel = sockets 5-8). Once we get feedback that the current featureset is working well, we'll remove this restriction.
To blink an LED attached to pin A5 on the Shield Base:
// NOTE: be sure to add Microsoft.SPOT.Hardware.dll as a reference to your project.
// use the Shield Base on socket 5 (nothing else plugged into sockets 6-8 for the moment)
NetduinoGo.ShieldBase shieldBase = new NetduinoGo.ShieldBase(GoSockets.Socket5);
Microsoft.SPOT.Hardware.OutputPort ledPort = new Microsoft.SPOT.Hardware.OutputPort(shieldBase.Pins.GPIO_PIN_A5, false);
while (true)
{
ledPort.Write(!ledPort.Read());
System.Threading.Thread.Sleep(250);
}
Please post any questions or feedback here. Thank you.
Chris











