SunSPOT API V6.0


com.sun.spot.sensorboard.peripheral
Class TriColorLEDArray

java.lang.Object
  extended by com.sun.spot.resources.Resource
      extended by com.sun.spot.resources.CompositeResource
          extended by com.sun.spot.resources.transducers.CompositeTransducer
              extended by com.sun.spot.sensorboard.peripheral.TriColorLEDArray
All Implemented Interfaces:
ICompositeResource, IResource, ICompositeTransducer, ITriColorLEDArray

public class TriColorLEDArray
extends CompositeTransducer
implements ITriColorLEDArray

Access and control of an array of 3 color LEDs


Field Summary
 
Fields inherited from class com.sun.spot.resources.CompositeResource
resources
 
Constructor Summary
TriColorLEDArray()
           
 
Method Summary
 void add(ITransducer t)
           
 ITriColorLED getLED(int i)
          Return the Nth LED in the array
 void setColor(LEDColor clr)
          Set the color of the LEDs.
 void setOff()
          Turn all the LEDs off
 void setOn()
          Turn all the LEDs on
 void setOn(boolean on)
          Set all the LED's state
 void setOn(int bits)
          Set each LED's state based on the bits flag.
 void setRGB(int redRGB, int greenRGB, int blueRGB)
          Set the colour of all the LEDs in the array.
 int size()
          Return the number of LEDs in the array
 ITriColorLED[] toArray()
          Return all the LEDs in an array
 
Methods inherited from class com.sun.spot.resources.transducers.CompositeTransducer
remove
 
Methods inherited from class com.sun.spot.resources.CompositeResource
add, internalAt, internalSize, lookup, lookup, lookup, lookup, lookup, lookupAll, lookupAll, lookupAll, lookupAll, lookupAll, remove
 
Methods inherited from class com.sun.spot.resources.Resource
addTag, getTags, getTagValue, hasTag, removeTag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.spot.resources.transducers.ICompositeTransducer
remove
 
Methods inherited from interface com.sun.spot.resources.ICompositeResource
add, lookup, lookup, lookup, lookup, lookup, lookupAll, lookupAll, lookupAll, lookupAll, lookupAll, remove
 
Methods inherited from interface com.sun.spot.resources.IResource
addTag, getTags, getTagValue, hasTag, removeTag
 

Constructor Detail

TriColorLEDArray

public TriColorLEDArray()
Method Detail

size

public int size()
Return the number of LEDs in the array

Specified by:
size in interface ITriColorLEDArray
Returns:
the number of LEDs in the array

getLED

public ITriColorLED getLED(int i)
Return the Nth LED in the array

Specified by:
getLED in interface ITriColorLEDArray
Parameters:
i - the index of the LED to return
Returns:
the specified LED in the array

toArray

public ITriColorLED[] toArray()
Return all the LEDs in an array

Specified by:
toArray in interface ITriColorLEDArray
Returns:
the LEDs in an array

setOn

public void setOn()
Turn all the LEDs on

Specified by:
setOn in interface ITriColorLEDArray

setOff

public void setOff()
Turn all the LEDs off

Specified by:
setOff in interface ITriColorLEDArray

setOn

public void setOn(boolean on)
Set all the LED's state

Specified by:
setOn in interface ITriColorLEDArray
Parameters:
on - true to set all the LEDs on, false to set them off.

setOn

public void setOn(int bits)
Set each LED's state based on the bits flag.

Specified by:
setOn in interface ITriColorLEDArray
Parameters:
bits - set LED N on if (bits & 1 << N) != 0

setRGB

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

Specified by:
setRGB in interface ITriColorLEDArray
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 clr)
Set the color of the LEDs.

Specified by:
setColor in interface ITriColorLEDArray
Parameters:
clr - the new color

add

public void add(ITransducer t)
Specified by:
add in interface ICompositeTransducer
Overrides:
add in class CompositeTransducer

SunSPOT API V6.0


Copyright © 2006-2010 Oracle. All Rights Reserved.