com.phidgets
Class LEDPhidget

java.lang.Object
  extended bycom.phidgets.Phidget
      extended bycom.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.

Author:
Phidgets Inc.

Field Summary
static int PHIDGET_LED_CURRENT_LIMIT_20mA
          20mA current limit.
static int PHIDGET_LED_CURRENT_LIMIT_40mA
          40mA current limit.
static int PHIDGET_LED_CURRENT_LIMIT_60mA
          60mA current limit.
static int PHIDGET_LED_CURRENT_LIMIT_80mA
          80mA current limit.
static int PHIDGET_LED_VOLTAGE_1_7V
          1.7V Voltage output.
static int PHIDGET_LED_VOLTAGE_2_75V
          2.75V Voltage output.
static int PHIDGET_LED_VOLTAGE_3_9V
          3.9V Voltage output.
static int PHIDGET_LED_VOLTAGE_5_0V
          5.0V Voltage output.
 
Fields inherited from class com.phidgets.Phidget
PHIDCLASS_ACCELEROMETER, PHIDCLASS_ADVANCEDSERVO, PHIDCLASS_ANALOG, PHIDCLASS_BRIDGE, PHIDCLASS_ENCODER, PHIDCLASS_FREQUENCYCOUNTER, PHIDCLASS_GPS, PHIDCLASS_INTERFACEKIT, PHIDCLASS_LED, PHIDCLASS_MOTORCONTROL, PHIDCLASS_NOTHING, PHIDCLASS_PHSENSOR, PHIDCLASS_RFID, PHIDCLASS_SERVO, PHIDCLASS_STEPPER, PHIDCLASS_TEMPERATURESENSOR, PHIDCLASS_TEXTLCD, PHIDCLASS_TEXTLED, PHIDCLASS_WEIGHTSENSOR, PHIDGET_LOG_CRITICAL, PHIDGET_LOG_DEBUG, PHIDGET_LOG_ERROR, PHIDGET_LOG_INFO, PHIDGET_LOG_VERBOSE, PHIDGET_LOG_WARNING, PHIDID_ACCELEROMETER_2AXIS, PHIDID_ACCELEROMETER_3AXIS, PHIDID_ADVANCEDSERVO_1MOTOR, PHIDID_ADVANCEDSERVO_8MOTOR, PHIDID_ANALOG_4OUTPUT, PHIDID_BIPOLAR_STEPPER_1MOTOR, PHIDID_BRIDGE_4INPUT, PHIDID_ENCODER_1ENCODER_1INPUT, PHIDID_ENCODER_HS_1ENCODER, PHIDID_ENCODER_HS_4ENCODER_4INPUT, PHIDID_FREQUENCYCOUNTER_2INPUT, PHIDID_GPS, PHIDID_INTERFACEKIT_0_0_4, PHIDID_INTERFACEKIT_0_0_8, PHIDID_INTERFACEKIT_0_16_16, PHIDID_INTERFACEKIT_0_8_8_w_LCD, PHIDID_INTERFACEKIT_2_2_2, PHIDID_INTERFACEKIT_4_8_8, PHIDID_INTERFACEKIT_8_8_8, PHIDID_INTERFACEKIT_8_8_8_w_LCD, PHIDID_IR, PHIDID_LED_64, PHIDID_LED_64_ADV, PHIDID_LINEAR_TOUCH, PHIDID_MOTORCONTROL_1MOTOR, PHIDID_MOTORCONTROL_HC_2MOTOR, PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT, PHIDID_NOTHING, PHIDID_PHSENSOR, PHIDID_RFID, PHIDID_RFID_2OUTPUT, PHIDID_RFID_2OUTPUT_READ_WRITE, PHIDID_ROTARY_TOUCH, PHIDID_SERVO_1MOTOR, PHIDID_SERVO_1MOTOR_OLD, PHIDID_SERVO_4MOTOR, PHIDID_SERVO_4MOTOR_OLD, PHIDID_SPATIAL_ACCEL_3AXIS, PHIDID_SPATIAL_ACCEL_GYRO_COMPASS, PHIDID_TEMPERATURESENSOR, PHIDID_TEMPERATURESENSOR_4, PHIDID_TEMPERATURESENSOR_IR, PHIDID_TEXTLCD_2x20, PHIDID_TEXTLCD_2x20_w_0_8_8, PHIDID_TEXTLCD_2x20_w_8_8_8, PHIDID_TEXTLCD_ADAPTER, PHIDID_TEXTLED_1x8, PHIDID_TEXTLED_4x8, PHIDID_UNIPOLAR_STEPPER_4MOTOR, PHIDID_WEIGHTSENSOR
 
Constructor Summary
LEDPhidget()
           
 
Method Summary
 double getBrightness(int index)
          Returns the brightness value of an LED.
 int getCurrentLimit()
          Returns the current limit for the all outputs.
 double getCurrentLimit(int index)
          Returns the current limit value of an LED.
 int getDiscreteLED(int index)
          Deprecated.
 int getLEDCount()
          Returns the number of LEDs that this board can drive.
 int getVoltage()
          Returns the voltage output for the all outputs.
 void setBrightness(int index, double brightness)
          Sets the brightness of an LED.
 void setCurrentLimit(int currentLimit)
          Sets the current limit for all outputs.
 void setCurrentLimit(int index, double limit)
          Sets the current limit of an LED.
 void setDiscreteLED(int index, int brightness)
          Deprecated.
 void setVoltage(int voltage)
          Sets the voltage output for all outputs.
 
Methods inherited from class com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, addServerConnectListener, addServerDisconnectListener, close, disableLogging, enableLogging, equals, getDeviceClass, getDeviceID, getDeviceLabel, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getServerAddress, getServerID, getServerPort, isAttached, isAttachedToServer, log, open, open, open, open, open, openAny, openAny, openAny, openAny, openAny, openLabel, openLabel, openLabel, openLabel, openLabel, removeAttachListener, removeDetachListener, removeErrorListener, removeServerConnectListener, removeServerDisconnectListener, setDeviceLabel, toString, waitForAttachment, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PHIDGET_LED_CURRENT_LIMIT_20mA

public static final int PHIDGET_LED_CURRENT_LIMIT_20mA
20mA current limit. This is used with getCurrentLimit and setCurrentLimit

See Also:
Constant Field Values

PHIDGET_LED_CURRENT_LIMIT_40mA

public static final int PHIDGET_LED_CURRENT_LIMIT_40mA
40mA current limit. This is used with getCurrentLimit and setCurrentLimit

See Also:
Constant Field Values

PHIDGET_LED_CURRENT_LIMIT_60mA

public static final int PHIDGET_LED_CURRENT_LIMIT_60mA
60mA current limit. This is used with getCurrentLimit and setCurrentLimit

See Also:
Constant Field Values

PHIDGET_LED_CURRENT_LIMIT_80mA

public static final int PHIDGET_LED_CURRENT_LIMIT_80mA
80mA current limit. This is used with getCurrentLimit and setCurrentLimit

See Also:
Constant Field Values

PHIDGET_LED_VOLTAGE_1_7V

public static final int PHIDGET_LED_VOLTAGE_1_7V
1.7V Voltage output. This is used with getVoltage and setVoltage

See Also:
Constant Field Values

PHIDGET_LED_VOLTAGE_2_75V

public static final int PHIDGET_LED_VOLTAGE_2_75V
2.75V Voltage output. This is used with getVoltage and setVoltage

See Also:
Constant Field Values

PHIDGET_LED_VOLTAGE_3_9V

public static final int PHIDGET_LED_VOLTAGE_3_9V
3.9V Voltage output. This is used with getVoltage and setVoltage

See Also:
Constant Field Values

PHIDGET_LED_VOLTAGE_5_0V

public static final int PHIDGET_LED_VOLTAGE_5_0V
5.0V Voltage output. This is used with getVoltage and setVoltage

See Also:
Constant Field Values
Constructor Detail

LEDPhidget

public LEDPhidget()
           throws PhidgetException
Method Detail

getCurrentLimit

public int getCurrentLimit()
                    throws PhidgetException
Returns the current limit for the all outputs. This is only supported by some PhidgetLEDs - see the product manual. The possible values for type are PHIDGET_LED_CURRENT_LIMIT_20mA, PHIDGET_LED_CURRENT_LIMIT_40mA, PHIDGET_LED_CURRENT_LIMIT_60mA and PHIDGET_LED_CURRENT_LIMIT_80mA

Returns:
Current Limit
Throws:
PhidgetException - If this Phidget is not opened and attached, if the index is out of range, or if unsupported by this board. See open for information on determining if a device is attached.

setCurrentLimit

public void setCurrentLimit(int currentLimit)
                     throws PhidgetException
Sets the current limit for all outputs. This is only supported by some PhidgetLEDs - see the product manual.

The possible values for type are PHIDGET_LED_CURRENT_LIMIT_20mA, PHIDGET_LED_CURRENT_LIMIT_40mA, PHIDGET_LED_CURRENT_LIMIT_60mA and PHIDGET_LED_CURRENT_LIMIT_80mA

By default, currentLimit is set to PHIDGET_LED_CURRENT_LIMIT_20mA.

Parameters:
currentLimit - Current Limit
Throws:
PhidgetException - If this Phidget is not opened and attached, if the index is out of range, or if unsupported by this board. See open for information on determining if a device is attached.

getVoltage

public int getVoltage()
               throws PhidgetException
Returns the voltage output for the all outputs. This is only supported by some PhidgetLEDs - see the product manual. The possible values for type are PHIDGET_LED_VOLTAGE_1_7V, PHIDGET_LED_VOLTAGE_2_75V, PHIDGET_LED_VOLTAGE_3_9V and PHIDGET_LED_VOLTAGE_5_0V

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

setVoltage

public void setVoltage(int voltage)
                throws PhidgetException
Sets the voltage output for all outputs. This is only supported by some PhidgetLEDs - see the product manual.

The possible values for type are PHIDGET_LED_VOLTAGE_1_7V, PHIDGET_LED_VOLTAGE_2_75V, PHIDGET_LED_VOLTAGE_3_9V and PHIDGET_LED_VOLTAGE_5_0V

By default, voltage is set to PHIDGET_LED_VOLTAGE_2_75V.

Parameters:
voltage - Voltage
Throws:
PhidgetException - If this Phidget is not opened and attached, if the index is out of range, or if unsupported by this board. See open for information on determining if a device is attached.

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
Deprecated. Use getBrightness

Throws:
PhidgetException

setDiscreteLED

public void setDiscreteLED(int index,
                           int brightness)
                    throws PhidgetException
Deprecated. Use setBrightness

Throws:
PhidgetException

getBrightness

public double getBrightness(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.

setBrightness

public void setBrightness(int index,
                          double brightness)
                   throws PhidgetException
Sets the brightness of an LED. Valid values are 0-100, with 0 being off and 100 being the brightest.

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 or brightness value are out of range. See open for information on determining if a device is attached.

getCurrentLimit

public double getCurrentLimit(int index)
                       throws PhidgetException
Returns the current limit value of an LED. This value ranges from 0-80 mA.

Parameters:
index - LED
Returns:
current limit
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.

setCurrentLimit

public void setCurrentLimit(int index,
                            double limit)
                     throws PhidgetException
Sets the current limit of an LED. Valid values are 0-80 mA.

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