24 October, 2011

Netduino: HelloWorld

I have always found it intriguing to be able to motion the physical world from your PC. Due to this reason – I’ve invested in a Netduino microcontroller (from the UK) which runs the .NET Microframework and therefore programmed in C#.

Every new technology is best learned by writing the famous “Hello World” sample for this technology which is also the case here. Below is the very few lines needed to make the onboard LED flash in a blinking fashion (as long as it is powered ;-)).

image       image

HelloWorld.cs

using System.Threading;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace HelloLED
{
public class Program
{
public static void Main()
{
//init ports
var port = new OutputPort(Pins.ONBOARD_LED, false);
bool on = true;

//loop
while (true)
{
port.Write(on);
Thread.Sleep(1000);
on = !on; //invert value
}
}
}
}
How easy can it get…?

Link: http://www.netduino.com/

No comments:

iPhone/XCode - not all cases are equal!

This bit me! Having made some changes to an iPhone application (Obj-C); everything worked fine in the simulator. But, when deploying the s...