com.phidgets
Class TextLCDPhidget

java.lang.Object
  extended bycom.phidgets.Phidget
      extended bycom.phidgets.TextLCDPhidget

public final class TextLCDPhidget
extends Phidget

This class represents a Phidget Text LCD. All methods to control the Text LCD are implemented in this class.

The TextLCD Phidget consists of a Vacuum Fluorescent display that is capable of displaying Standard as well as custom characters in multiple rows.

Author:
Phidgets Inc.

Field Summary
static int PHIDGET_TEXTLCD_SCREEN_1x16
          1 row, 16 column screen.
static int PHIDGET_TEXTLCD_SCREEN_1x40
          1 row, 40 column screen.
static int PHIDGET_TEXTLCD_SCREEN_1x8
          1 row, 8 column screen.
static int PHIDGET_TEXTLCD_SCREEN_2x16
          2 row, 16 column screen.
static int PHIDGET_TEXTLCD_SCREEN_2x20
          2 row, 20 column screen.
static int PHIDGET_TEXTLCD_SCREEN_2x24
          2 row, 24 column screen.
static int PHIDGET_TEXTLCD_SCREEN_2x40
          2 row, 40 column screen.
static int PHIDGET_TEXTLCD_SCREEN_2x8
          2 row, 8 column screen.
static int PHIDGET_TEXTLCD_SCREEN_4x16
          4 row, 16 column screen.
static int PHIDGET_TEXTLCD_SCREEN_4x20
          4 row, 20 column screen.
static int PHIDGET_TEXTLCD_SCREEN_4x40
          4 row, 40 column screen.
static int PHIDGET_TEXTLCD_SCREEN_NONE
          No screens attached.
static int PHIDGET_TEXTLCD_SCREEN_UNKNOWN
          Unknown screen size.
 
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
TextLCDPhidget()
           
 
Method Summary
 boolean getBacklight()
          Returns the status of the backlight.
 int getBrightness()
          Returns the brightness of the display.
 int getColumnCount()
          Returns the number of columns (characters per row) available on the display.
 int getContrast()
          Returns the contrast of the display.
 boolean getCursor()
          Returns the status of the cursor.
 boolean getCursorBlink()
          Returns the status of the cursor blink.
 int getRowCount()
          Returns the number of rows available on the display.
 int getScreen()
          Returns the active screen.
 int getScreenCount()
          Returns the number of screens supported by the TextLCD.
 int getScreenSize()
          Returns the screen size for the active TextLCD display.
 void initialize()
          Initializes the active TextLCD Display.
 void setBacklight(boolean backlight)
          Sets the status of the backlight.
 void setBrightness(int brightness)
          Sets the brightness of the display.
 void setContrast(int contrast)
          Sets the contrast of the display.
 void setCursor(boolean cursor)
          Sets the state of the cursor.
 void setCursorBlink(boolean cursorblink)
          Sets the state of the cursor blink.
 void setCustomCharacter(int index, int param1, int param2)
          Sets a custom character.
 void setDisplayCharacter(int row, int column, char character)
          Sets the character to display at a certain row and column.
 void setDisplayString(int index, java.lang.String text)
          Sets the display string of a certain row.
 void setScreen(int screen)
          Sets the active screen.
 void setScreenSize(int screenSize)
          Sets the screen size for the active TextLCD display.
 
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_TEXTLCD_SCREEN_NONE

public static final int PHIDGET_TEXTLCD_SCREEN_NONE
No screens attached. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_1x8

public static final int PHIDGET_TEXTLCD_SCREEN_1x8
1 row, 8 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_2x8

public static final int PHIDGET_TEXTLCD_SCREEN_2x8
2 row, 8 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_1x16

public static final int PHIDGET_TEXTLCD_SCREEN_1x16
1 row, 16 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_2x16

public static final int PHIDGET_TEXTLCD_SCREEN_2x16
2 row, 16 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_4x16

public static final int PHIDGET_TEXTLCD_SCREEN_4x16
4 row, 16 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_2x20

public static final int PHIDGET_TEXTLCD_SCREEN_2x20
2 row, 20 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_4x20

public static final int PHIDGET_TEXTLCD_SCREEN_4x20
4 row, 20 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_2x24

public static final int PHIDGET_TEXTLCD_SCREEN_2x24
2 row, 24 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_1x40

public static final int PHIDGET_TEXTLCD_SCREEN_1x40
1 row, 40 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_2x40

public static final int PHIDGET_TEXTLCD_SCREEN_2x40
2 row, 40 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_4x40

public static final int PHIDGET_TEXTLCD_SCREEN_4x40
4 row, 40 column screen. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values

PHIDGET_TEXTLCD_SCREEN_UNKNOWN

public static final int PHIDGET_TEXTLCD_SCREEN_UNKNOWN
Unknown screen size. This is used with getScreenSize and setScreenSize

See Also:
Constant Field Values
Constructor Detail

TextLCDPhidget

public TextLCDPhidget()
               throws PhidgetException
Method Detail

getRowCount

public int getRowCount()
                throws PhidgetException
Returns the number of rows available on the display.

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

getColumnCount

public int getColumnCount()
                   throws PhidgetException
Returns the number of columns (characters per row) available on the display. This value is the same for every row.

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

getScreenCount

public int getScreenCount()
                   throws PhidgetException
Returns the number of screens supported by the TextLCD. Not all TextLCDs support this method.

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

getScreen

public int getScreen()
              throws PhidgetException
Returns the active screen. Not all TextLCDs support this method.

Returns:
active screen
Throws:
PhidgetException - If this Phidget is not opened and attached, or screen is not supported. See open for information on determining if a device is attached.

setScreen

public void setScreen(int screen)
               throws PhidgetException
Sets the active screen. All other API calls depend on this being called first to select the screen that subsequent calls affect. When making calls from multiple threads, selecting the screen should be synchronized with setting screen properties in order to avoid having messages go to the wrong display. Not all TextLCDs support this method.

Parameters:
screen - Screen
Throws:
PhidgetException - If this Phidget is not opened and attached, the screen number is out of range, or screen is not supported. See open for information on determining if a device is attached.

getScreenSize

public int getScreenSize()
                  throws PhidgetException
Returns the screen size for the active TextLCD display. The TextLCD Adapter supports a pre-defined set of screen sizes to choose from. By default, all screens are set to PHIDGET_TEXTLCD_SCREEN_NONE. Not all TextLCDs support this method.

The possible values for screen size are PHIDGET_TEXTLCD_SCREEN_NONE, PHIDGET_TEXTLCD_SCREEN_1x8, PHIDGET_TEXTLCD_SCREEN_2x8, PHIDGET_TEXTLCD_SCREEN_1x16, PHIDGET_TEXTLCD_SCREEN_2x16, PHIDGET_TEXTLCD_SCREEN_4x16, PHIDGET_TEXTLCD_SCREEN_2x20, PHIDGET_TEXTLCD_SCREEN_4x20, PHIDGET_TEXTLCD_SCREEN_2x24, PHIDGET_TEXTLCD_SCREEN_1x40, PHIDGET_TEXTLCD_SCREEN_2x40, PHIDGET_TEXTLCD_SCREEN_4x40, PHIDGET_TEXTLCD_SCREEN_UNKNOWN

By default, all screens are set to PHIDGET_TEXTLCD_SCREEN_NONE

Returns:
screen size
Throws:
PhidgetException - If this Phidget is not opened and attached, or screen size is not supported. See open for information on determining if a device is attached.

setScreenSize

public void setScreenSize(int screenSize)
                   throws PhidgetException
Sets the screen size for the active TextLCD display. The TextLCD Adapter supports a pre-defined set of screen sizes to choose from. This method must always be called when trying to write text to a display. Not all TextLCDs support this method.

Parameters:
screenSize - Screen size The possible values for screen size are PHIDGET_TEXTLCD_SCREEN_NONE, PHIDGET_TEXTLCD_SCREEN_1x8, PHIDGET_TEXTLCD_SCREEN_2x8, PHIDGET_TEXTLCD_SCREEN_1x16, PHIDGET_TEXTLCD_SCREEN_2x16, PHIDGET_TEXTLCD_SCREEN_4x16, PHIDGET_TEXTLCD_SCREEN_2x20, PHIDGET_TEXTLCD_SCREEN_4x20, PHIDGET_TEXTLCD_SCREEN_2x24, PHIDGET_TEXTLCD_SCREEN_1x40, PHIDGET_TEXTLCD_SCREEN_2x40, PHIDGET_TEXTLCD_SCREEN_4x40, PHIDGET_TEXTLCD_SCREEN_UNKNOWN

By default, all screens are set to PHIDGET_TEXTLCD_SCREEN_NONE

Throws:
PhidgetException - If this Phidget is not opened and attached, the screen number is out of range, or screen size is not supported. See open for information on determining if a device is attached.

getContrast

public int getContrast()
                throws PhidgetException
Returns the contrast of the display. This is the contrast of the entire display.

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

setContrast

public void setContrast(int contrast)
                 throws PhidgetException
Sets the contrast of the display. The valid range is 0-255. Changing the contrast can increase the readability of the display in certain viewing situation, such as at an odd angle.

Parameters:
contrast - New contrast to set
Throws:
PhidgetException - If this Phidget is not opened and attached, or the contrast value is out of range. See open for information on determining if a device is attached.

getBrightness

public int getBrightness()
                  throws PhidgetException
Returns the brightness of the display. This is the brightness of the backlight. Not all TextLCDs support this method.

Returns:
Current brightness
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached, or brightness is not supported.

setBrightness

public void setBrightness(int brightness)
                   throws PhidgetException
Sets the brightness of the display. The valid range is 0-255. Changing the brightness can increase the readability of the display in certain viewing situation, such as at an odd angle. Not all TextLCDs support this method.

Parameters:
brightness - New brightness to set
Throws:
PhidgetException - If this Phidget is not opened and attached, or the brightness value is out of range, or brightness is not supported. See open for information on determining if a device is attached.

getBacklight

public boolean getBacklight()
                     throws PhidgetException
Returns the status of the backlight. True indicated that the backlight is on, False indicated that it is off. The backlight is by default turned on.

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

setBacklight

public void setBacklight(boolean backlight)
                  throws PhidgetException
Sets the status of the backlight. True turns the backlight on, False turns it off. The backlight is by default turned on.

Parameters:
backlight - New backlight state
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getCursor

public boolean getCursor()
                  throws PhidgetException
Returns the status of the cursor. True turns the cursor is on, False turns it off. The cursor is an underscore which appears directly to the right of the last entered character on the display. The cursor is by default disabled.

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

setCursor

public void setCursor(boolean cursor)
               throws PhidgetException
Sets the state of the cursor. True indicates that the cursor on, False indicates that it is off. The cursor is an underscore which appears directly to the right of the last entered character on the display. The cursor is by default disabled.

Parameters:
cursor - New cursor state
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the cursor has not been set See open for information on determining if a device is attached.

getCursorBlink

public boolean getCursorBlink()
                       throws PhidgetException
Returns the status of the cursor blink. True turns the cursor blink on, False turns it off. The cursor blink is an flashing box which appears directly to the right of the last entered character on the display, in the same spot as the cursor if it is enabled. The cursor blink is by default disabled.

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

setCursorBlink

public void setCursorBlink(boolean cursorblink)
                    throws PhidgetException
Sets the state of the cursor blink. True indicates that the cursor blink is on, False indicates that it is off. The cursor blink is an flashing box which appears directly to the right of the last entered character on the display, in the same spot as the cursor if it is enabled. The cursor blink is by default disabled.

Parameters:
cursorblink - New cursor blink state
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the cursor has not been set. See open for information on determining if a device is attached.

setDisplayString

public void setDisplayString(int index,
                             java.lang.String text)
                      throws PhidgetException
Sets the display string of a certain row.

Parameters:
index - row
text - String
Throws:
PhidgetException - If this Phidget is not opened and attached, if the string is too long, or if the row is invalid. See open for information on determining if a device is attached.

setDisplayCharacter

public void setDisplayCharacter(int row,
                                int column,
                                char character)
                         throws PhidgetException
Sets the character to display at a certain row and column.

Parameters:
row - row
column - column
character - character
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the row or column is invalid. See open for information on determining if a device is attached.

setCustomCharacter

public void setCustomCharacter(int index,
                               int param1,
                               int param2)
                        throws PhidgetException
Sets a custom character. You can set up to 8 custom characters, each one is completely defined by two integers, and gets stored in the character display until power is removed, whence they must be re-programmed. The characters lie in positions 8-15, and can be displayed by sending these codes to setDisplayString in amongst standard ASCII characters. See the TextLCD Java example for more information.

Parameters:
index - position ( 8-15 )
param1 - first half of the character code
param2 - second half of the character code
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is invalid. See open for information on determining if a device is attached.

initialize

public void initialize()
                throws PhidgetException
Initializes the active TextLCD Display. This runs an initialization routine which sets up and clears the display. This can be used for activating a display that was plugged in after the TextLCD Adapter was attached, to clear the display after setting/getting the screen size, and to re-initialize a display if it has become corrupted(display not working). Not all TextLCDs supported this method.

Throws:
PhidgetException - If this Phidget is not opened and attached, or initialize is not supported. See open for information on determining if a device is attached.