grove.display.jhd1802
¶
- This is the code for
Examples
import time
from grove.factory import Factory
# LCD 16x2 Characters
lcd = Factory.getDisplay("JHD1802")
rows, cols = lcd.size()
print("LCD model: {}".format(lcd.name))
print("LCD type : {} x {}".format(cols, rows))
lcd.setCursor(0, 0)
lcd.write("hello world!")
lcd.setCursor(0, cols - 1)
lcd.write('X')
lcd.setCursor(rows - 1, 0)
for i in range(cols):
lcd.write(chr(ord('A') + i))
time.sleep(3)
lcd.clear()
Classes¶
JHD1802
: Grove - 16 x 2 LCD, using chip JHD1802.
- class grove.display.jhd1802.JHD1802(address=62)[source]¶
- Grove - 16 x 2 LCD, using chip JHD1802.
Grove - 16 x 2 LCD (Black on Yellow)
Grove - 16 x 2 LCD (Black on Red)
Grove - 16 x 2 LCD (White on Blue)
Also, it’s our class name, which could drive the above three LCDs.
- Parameters:
address (int) – I2C device address, default to 0x3E.
Inheritance
digraph inheritance0cd27edabe { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Display" [URL="grove.display.base.html#grove.display.base.Display",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="All display devices should inherit this virtual class,"]; "JHD1802" [URL="#grove.display.jhd1802.JHD1802",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Grove - 16 x 2 LCD, using chip JHD1802."]; "Display" -> "JHD1802" [arrowsize=0.5,style="setlinewidth(0.5)"]; }- home()[source]¶
Positions the cursor in the upper-left of the LCD. That is, use that location in outputting subsequent text to the display.
- property name¶
Get device name
- Returns:
JHD1802
- Return type:
string
- setCursor(row, column)[source]¶
Position the LCD cursor; that is, set the location at which subsequent text written to the LCD will be displayed.
- Parameters:
row (int) – the row at which to position cursor, with 0 being the first row
column (int) – the column at which to position cursor, with 0 being the first column
- Returns:
None