Home NetduinoNetduino Code RGB LED and Netduino example

RGB LED and Netduino example

This example uses the NET Micro Framework Toolbox available from http://netmftoolbox.codeplex.com/

We simply flash a RGB LED .

Code

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

namespace RGB_Led
{
public class Program
{
public static void Main()
{
// Some RGB-leds are common anode, in those cases, set the last boolean on true
RgbLed Led = new RgbLed(new Netduino.PWM(Pins.GPIO_PIN_D9), new Netduino.PWM(Pins.GPIO_PIN_D6), new Netduino.PWM(Pins.GPIO_PIN_D5), true);

while (true)
{
Led.Write(255, 0, 0);
Thread.Sleep(1000);
Led.Write(0, 255, 0);
Thread.Sleep(1000);
Led.Write(0, 0, 255);
Thread.Sleep(1000);
}
}

}
}

You may also like