Toolbox.NETMF.Hardware.RgbLed


Toolbox.NETMF.Hardware.RgbLed(RedPin, GreenPin, BluePin, CommonAnode)
  • RedPin The pin the red led pin is connected to
  • GreenPin The pin the green led pin is connected to
  • BluePin The pin the blue led pin is connected to
  • CommonAnode When true, values will be inverted (default: true)

Methods

  • Write(Value) Writes an integer value (0x000000 to 0xffffff)
  • Write(Red, Green, Blue) Writes three values from 0 to 255

How to connect

Toolbox.NETMF.Hardware.RgbLed.png

Sample code in C#

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), false);
Led.Write(0x0000ff); // Blue
Led.Write(0x00ff00); // Green
Led.Write(0x00ffff); // Turquoise
Led.Write(0xff0000); // Red
Led.Write(0xff00ff); // Purple
Led.Write(0xffff00); // Yellow
Led.Write(0xffffff); // White
Led.Write(0x000000); // Off

Sample code in VB

Dim Led As RgbLed = New RgbLed(new Netduino.PWM(Pins.GPIO_PIN_D9), new Netduino.PWM(Pins.GPIO_PIN_D6), new Netduino.PWM(Pins.GPIO_PIN_D5), False)
Led.Write(CInt(Tools.Hex2Dec("0000ff"))) ' Blue
Led.Write(CInt(Tools.Hex2Dec("00ff00"))) ' Green
Led.Write(CInt(Tools.Hex2Dec("00ffff"))) ' Turquoise
Led.Write(CInt(Tools.Hex2Dec("ff0000"))) ' Red
Led.Write(CInt(Tools.Hex2Dec("ff00ff"))) ' Purple
Led.Write(CInt(Tools.Hex2Dec("ffff00"))) ' Yellow
Led.Write(CInt(Tools.Hex2Dec("ffffff"))) ' White
Led.Write(CInt(Tools.Hex2Dec("000000"))) ' Off

Last edited May 14, 2012 at 10:48 PM by Garrcomm, version 2