Class LCD1602Helper
java.lang.Object
com.opensourcewithslu.outputdevices.LCD1602Helper
This helper class, LCD1602Helper, is for controlling and interacting with an I2C LCD1602 display.
-
Constructor Summary
ConstructorsConstructorDescriptionLCD1602Helper(com.pi4j.io.i2c.I2CConfig i2CConfig, com.pi4j.context.Context pi4jContext) The LCD1602Helper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the display of text.voidclearLine(int line) Clears the text of the specified line.voiddisplayTextAtPos(String text, int line, int position) Displays text at a specific line and position.voidsetBackLight(boolean state) Setting the backlight state of the LCD based off the boolean input.voidturnOff()Turns off LCD Display.voidwriteCharacter(char charvalue) Writes a character to the text displayed.voidWrites a String to the display.voidwriteTextAtLine(String text, int line) Writes a String to the defined line.
-
Constructor Details
-
LCD1602Helper
public LCD1602Helper(com.pi4j.io.i2c.I2CConfig i2CConfig, com.pi4j.context.Context pi4jContext) The LCD1602Helper constructor.- Parameters:
i2CConfig- Unused parameter.pi4jContext- Context used to create LCD display object.
-
-
Method Details
-
writeText
Writes a String to the display.- Parameters:
text- String object.
-
writeTextAtLine
Writes a String to the defined line.- Parameters:
text- String object to be displayed.line- Line on which the String is written.
-
writeCharacter
public void writeCharacter(char charvalue) Writes a character to the text displayed.- Parameters:
charvalue- A single character.
-
setBackLight
public void setBackLight(boolean state) Setting the backlight state of the LCD based off the boolean input. If true, then the backlight is set as on.- Parameters:
state- Boolean input to determine backlight state.
-
clearDisplay
public void clearDisplay()Clears the display of text. -
clearLine
public void clearLine(int line) Clears the text of the specified line.- Parameters:
line- The line of which text will be cleared.
-
turnOff
public void turnOff()Turns off LCD Display. Works the same as backlight off, but a write or clear command will turn the display back on. -
displayTextAtPos
Displays text at a specific line and position.- Parameters:
text- The text to display.line- The line number.position- The column number to start from.
-