MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / __init__

Method __init__

mpython/lib/lcd2004.py:11–24  ·  view source on GitHub ↗
(self, ADDR, I2C)

Source from the content-addressed store, hash-verified

9class lcd:
10 # initializes objects and lcd
11 def __init__(self, ADDR, I2C):
12 self.i2c = I2C
13 self.address = ADDR
14 self.BKLIGHT = 0x08 # Set Backlight ON
15 self.lcd_write(0x03)
16 self.lcd_write(0x03)
17 self.lcd_write(0x03)
18 self.lcd_write(0x02)
19
20 self.lcd_write(0x20 | 0x08 | 0x04 | 0x00) # Set Functions 2Line,5x8,4Bit Mode
21 self.lcd_write(0x08 | 0x04) # Turn Display On
22 self.lcd_write(0x01) # Clear Screen
23 self.lcd_write(0x04 | 0x02) # Set Entry Mode Left -> Right
24 sleep_ms(300)
25
26 def lcd_strobe(self, data):
27 self.i2c.writeto(self.address, bytes([data | Enable | self.BKLIGHT]))

Callers

nothing calls this directly

Calls 1

lcd_writeMethod · 0.95

Tested by

no test coverage detected