SunSPOT API V5.0


com.sun.spot.sensorboard.peripheral
Class TriColorLED

java.lang.Object
  extended by com.sun.spot.sensorboard.peripheral.TriColorLED
All Implemented Interfaces:
ILed, ITriColorLED

public class TriColorLED
extends Object
implements ITriColorLED

Provides access to the colored LEDs. LED state is now kept by the ITriColorLEDController.


Constructor Summary
TriColorLED(PinDescriptor pidx, ITriColorLEDController cntrl)
          Constructor.
 
Method Summary
 int getBlue()
          Return the current blue setting.
 LEDColor getColor()
          Get the current color of the LED.
 int getGreen()
          Return the current green setting.
 PinDescriptor getIndex()
          Return the PinDescriptor associated with this LED.
 int getRed()
          Return the current red setting.
 boolean isOn()
          Return if the LED is on or off.
 void setColor(LEDColor rgb)
          Set the color of the LED
 void setOff()
          Turn the LED off.
 void setOn()
          Turn the LED on, using the currently stored intensity values (initially zero).
 void setOn(boolean on)
          Turn the LED on or off
 void setRGB(int redRGB, int greenRGB, int blueRGB)
          Set the colour of the LED.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriColorLED

public TriColorLED(PinDescriptor pidx,
                   ITriColorLEDController cntrl)
Constructor. Should only be called by EDemoBoard.

Parameters:
pidx - the pin connected to this LED
cntrl - the SPI controller for this LED
Method Detail

getIndex

public PinDescriptor getIndex()
Return the PinDescriptor associated with this LED.

Specified by:
getIndex in interface ITriColorLED
Returns:
the PinDescriptor associated with this LED.

setRGB

public void setRGB(int redRGB,
                   int greenRGB,
                   int blueRGB)
Set the colour of the LED. The colour will only change if the LED is on, but the values supplied are stored.

Specified by:
setRGB in interface ITriColorLED
Parameters:
redRGB - the intensity of the red portion, in the range 0-255
greenRGB - the intensity of the green portion, in the range 0-255
blueRGB - the intensity of the blue portion, in the range 0-255

setColor

public void setColor(LEDColor rgb)
Set the color of the LED

Specified by:
setColor in interface ITriColorLED
Parameters:
rgb - the new color

setOn

public void setOn()
Turn the LED on, using the currently stored intensity values (initially zero).

Specified by:
setOn in interface ILed

setOff

public void setOff()
Turn the LED off.

Specified by:
setOff in interface ILed

setOn

public void setOn(boolean on)
Turn the LED on or off

Specified by:
setOn in interface ILed
Parameters:
on - turn LED on if true

isOn

public boolean isOn()
Return if the LED is on or off.

Specified by:
isOn in interface ILed
Returns:
true if the LED is currently on

getRed

public int getRed()
Return the current red setting.

Specified by:
getRed in interface ITriColorLED
Returns:
the current red setting

getGreen

public int getGreen()
Return the current green setting.

Specified by:
getGreen in interface ITriColorLED
Returns:
the current green setting

getBlue

public int getBlue()
Return the current blue setting.

Specified by:
getBlue in interface ITriColorLED
Returns:
the current blue setting

getColor

public LEDColor getColor()
Get the current color of the LED.

Specified by:
getColor in interface ITriColorLED
Returns:
the current color

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.