com.phidgets
Class LEDPhidget

java.lang.Object
  extended by com.phidgets.Phidget
      extended by com.phidgets.LEDPhidget

public final class LEDPhidget
extends Phidget

This class represents a Phidget LED. All methods to control a Phidget LED are implemented in this class.

The Phidget LED is a board that is meant for driving LEDs. Currently, the only available version drives 64 LEDs, but other versions may become available so this number is not absolute.

LEDs can be controlled individually, at brightness levels from 0-100.


Constructor Summary
LEDPhidget()
           
 
Method Summary
 int getDiscreteLED(int index)
          Returns the brightness value of an LED.
 int getLEDCount()
          Returns the number of LEDs that this board can drive.
 void setDiscreteLED(int index, int brightness)
          Sets the brightness of an LED.
 
Methods inherited from class com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, close, equals, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getTag, isAttached, open, openAny, removeAttachListener, removeDetachListener, removeErrorListener, setTag, toString, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LEDPhidget

public LEDPhidget()
           throws PhidgetException
Throws:
PhidgetException
Method Detail

getLEDCount

public int getLEDCount()
                throws PhidgetException
Returns the number of LEDs that this board can drive. This may not correspond to the actual number of LEDs attached.

Returns:
number of LEDs
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getDiscreteLED

public int getDiscreteLED(int index)
                   throws PhidgetException
Returns the brightness value of an LED. This value ranges from 0-100.

Parameters:
index - LED
Returns:
brightness
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

setDiscreteLED

public void setDiscreteLED(int index,
                           int brightness)
                    throws PhidgetException
Sets the brightness of an LED. Valid values are 0-100, with 0 being off and 100 being the brightest. This 0-100 value is converted internally to a 6-bit value (0-63) so only 64 levels of brightness are actually possible.

Parameters:
index - index of the LED
brightness - desired brightness of this LED
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index of brightness value are out of range. See open for information on determining if a device is attached.