Home NetduinoNetduino Code Multi color LED Netduino code example

Multi color LED Netduino code example

Similar to Arduino example, same pinout. This will cycle through the red, green and blue colors.

 

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

namespace MultiLED
{
public class Program
{
public static void Main()
{
// write your code here
OutputPort redLED = new OutputPort(Pins.GPIO_PIN_D2, false);
OutputPort greenLED = new OutputPort(Pins.GPIO_PIN_D3, false);
OutputPort blueLED = new OutputPort(Pins.GPIO_PIN_D4, false);
while (true)
{

redLED.Write(true);
Thread.Sleep(1000);
redLED.Write(false);
Thread.Sleep(1000);
greenLED.Write(true);
Thread.Sleep(1000);
greenLED.Write(false);
Thread.Sleep(1000);
blueLED.Write(true);
Thread.Sleep(1000);
blueLED.Write(false);
Thread.Sleep(1000);

}
}

}
}

You may also like