public class BrickletLCD20x4 extends Device
Modifier and Type | Class and Description |
---|---|
static interface |
BrickletLCD20x4.ButtonPressedListener
This listener is triggered when a button is pressed.
|
static interface |
BrickletLCD20x4.ButtonReleasedListener
This listener is triggered when a button is released.
|
class |
BrickletLCD20x4.Config |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_BACKLIGHT_OFF |
static byte |
FUNCTION_BACKLIGHT_ON |
static byte |
FUNCTION_CLEAR_DISPLAY |
static byte |
FUNCTION_GET_CONFIG |
static byte |
FUNCTION_GET_CUSTOM_CHARACTER |
static byte |
FUNCTION_GET_DEFAULT_TEXT |
static byte |
FUNCTION_GET_DEFAULT_TEXT_COUNTER |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_IS_BACKLIGHT_ON |
static byte |
FUNCTION_IS_BUTTON_PRESSED |
static byte |
FUNCTION_SET_CONFIG |
static byte |
FUNCTION_SET_CUSTOM_CHARACTER |
static byte |
FUNCTION_SET_DEFAULT_TEXT |
static byte |
FUNCTION_SET_DEFAULT_TEXT_COUNTER |
static byte |
FUNCTION_WRITE_LINE |
Constructor and Description |
---|
BrickletLCD20x4(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addButtonPressedListener(BrickletLCD20x4.ButtonPressedListener listener)
Adds a ButtonPressed listener.
|
void |
addButtonReleasedListener(BrickletLCD20x4.ButtonReleasedListener listener)
Adds a ButtonReleased listener.
|
void |
backlightOff()
Turns the backlight off.
|
void |
backlightOn()
Turns the backlight on.
|
void |
clearDisplay()
Deletes all characters from the display.
|
BrickletLCD20x4.Config |
getConfig()
Returns the configuration as set by
setConfig(boolean, boolean) . |
short[] |
getCustomCharacter(short index)
Returns the custom character for a given index, as set with
setCustomCharacter(short, short[]) . |
java.lang.String |
getDefaultText(short line)
Returns the default text for a given line (0-3) as set by
setDefaultText(short, String) . |
int |
getDefaultTextCounter()
Returns the current value of the default text counter.
|
Device.Identity |
getIdentity()
Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
boolean |
isBacklightOn()
Returns *true* if the backlight is on and *false* otherwise.
|
boolean |
isButtonPressed(short button)
Returns *true* if the button (0 to 2 or 0 to 3 since hardware version 1.2)
is pressed.
|
void |
removeButtonPressedListener(BrickletLCD20x4.ButtonPressedListener listener)
Removes a ButtonPressed listener.
|
void |
removeButtonReleasedListener(BrickletLCD20x4.ButtonReleasedListener listener)
Removes a ButtonReleased listener.
|
void |
setConfig(boolean cursor,
boolean blinking)
Configures if the cursor (shown as "_") should be visible and if it
should be blinking (shown as a blinking block).
|
void |
setCustomCharacter(short index,
short[] character)
The LCD 20x4 Bricklet can store up to 8 custom characters.
|
void |
setDefaultText(short line,
java.lang.String text)
Sets the default text for lines 0-3.
|
void |
setDefaultTextCounter(int counter)
Sets the default text counter.
|
void |
writeLine(short line,
short position,
java.lang.String text)
Writes text to a specific line with a specific position.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_WRITE_LINE
public static final byte FUNCTION_CLEAR_DISPLAY
public static final byte FUNCTION_BACKLIGHT_ON
public static final byte FUNCTION_BACKLIGHT_OFF
public static final byte FUNCTION_IS_BACKLIGHT_ON
public static final byte FUNCTION_SET_CONFIG
public static final byte FUNCTION_GET_CONFIG
public static final byte FUNCTION_IS_BUTTON_PRESSED
public static final byte FUNCTION_SET_CUSTOM_CHARACTER
public static final byte FUNCTION_GET_CUSTOM_CHARACTER
public static final byte FUNCTION_SET_DEFAULT_TEXT
public static final byte FUNCTION_GET_DEFAULT_TEXT
public static final byte FUNCTION_SET_DEFAULT_TEXT_COUNTER
public static final byte FUNCTION_GET_DEFAULT_TEXT_COUNTER
public static final byte FUNCTION_GET_IDENTITY
public BrickletLCD20x4(java.lang.String uid, IPConnection ipcon)
public void writeLine(short line, short position, java.lang.String text) throws TinkerforgeException
TinkerforgeException
public void clearDisplay() throws TinkerforgeException
TinkerforgeException
public void backlightOn() throws TinkerforgeException
TinkerforgeException
public void backlightOff() throws TinkerforgeException
TinkerforgeException
public boolean isBacklightOn() throws TinkerforgeException
TinkerforgeException
public void setConfig(boolean cursor, boolean blinking) throws TinkerforgeException
writeLine(short, short, String)
.TinkerforgeException
public BrickletLCD20x4.Config getConfig() throws TinkerforgeException
setConfig(boolean, boolean)
.TinkerforgeException
public boolean isButtonPressed(short button) throws TinkerforgeException
BrickletLCD20x4.ButtonPressedListener
and BrickletLCD20x4.ButtonReleasedListener
listeners.TinkerforgeException
public void setCustomCharacter(short index, short[] character) throws TinkerforgeException
writeLine(short, short, String)
by using the
characters with the byte representation 8 ("\\x08" or "\\u0008") to 15
("\\x0F" or "\\u000F").
You can play around with the custom characters in Brick Viewer version
since 2.0.1.
Custom characters are stored by the LCD in RAM, so they have to be set
after each startup.
.. versionadded:: 2.0.1$nbsp;(Plugin)TinkerforgeException
public short[] getCustomCharacter(short index) throws TinkerforgeException
setCustomCharacter(short, short[])
.
.. versionadded:: 2.0.1$nbsp;(Plugin)TinkerforgeException
public void setDefaultText(short line, java.lang.String text) throws TinkerforgeException
setDefaultTextCounter(int)
.
.. versionadded:: 2.0.2$nbsp;(Plugin)TinkerforgeException
public java.lang.String getDefaultText(short line) throws TinkerforgeException
setDefaultText(short, String)
.
.. versionadded:: 2.0.2$nbsp;(Plugin)TinkerforgeException
public void setDefaultTextCounter(int counter) throws TinkerforgeException
setDefaultText(short, String)
) is shown on the LCD.
This functionality can be used to show a default text if the controlling
program crashes or the connection is interrupted.
A possible approach is to call setDefaultTextCounter(int)
every
minute with the parameter 1000*60*2 (2 minutes). In this case the
default text will be shown no later than 2 minutes after the
controlling program crashes.
A negative counter turns the default text functionality off.
.. versionadded:: 2.0.2$nbsp;(Plugin)TinkerforgeException
public int getDefaultTextCounter() throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addButtonPressedListener(BrickletLCD20x4.ButtonPressedListener listener)
public void removeButtonPressedListener(BrickletLCD20x4.ButtonPressedListener listener)
public void addButtonReleasedListener(BrickletLCD20x4.ButtonReleasedListener listener)
public void removeButtonReleasedListener(BrickletLCD20x4.ButtonReleasedListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.