Last week I got my GHI FEZ Internet of Things Kit, which includes – besides many accessory parts – a .NET-Microframework-powered Arduino-like board, the Netduino.

I started playing around with both the software and hardware, and the first thing that really worked was a very simple traffic light. It displays the light sequence red, red/yellow, green, yellow and back to red which is used in Germany. Although it is not that spectacular I’ve uploaded a short video showing the hardware setup and the light sequence.

This is the very simple code behind it:

using System;
using System.Threading;
using GHIElectronics.NETMF.FEZ;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace NetduinoTrafficLights
{
    public class TrafficLightsDE
    {
        public static OutputPort Red = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di1, false);
        public static OutputPort Yellow = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di0, false);
        public static OutputPort Green = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di3, false);

        public static void Main()
        {
            while (true)
            {
                Red.Write(true);
                Thread.Sleep(6000);

                Yellow.Write(true);
                Thread.Sleep(1000);

                Red.Write(false);
                Yellow.Write(false);
                Green.Write(true);
                Thread.Sleep(8000);

                Green.Write(false);
                Yellow.Write(true);
                Thread.Sleep(2000);

                Yellow.Write(false);
            }
        }

    }
}

Over the next weeks and month I will play around with more of the kit’s accessory parts and I’ll continue posting code (and maybe videos) about that. If you like (or don’t like) the video, feel free to leave a comment.

Tagged with:
 

Comments are closed.