June 16, 2024, 13:28
py import utime import machine from machine import I2C, Pin from lcd_api import LcdApi from pico_i2c_lcd import I2cLcd I2C_ADDR = 0x27 I2C_NUM_ROWS = 2 I2C_NUM_COLS = 16 sda = Pin(0) scl = Pin(1) i2c = I2C(0, sda=sda, scl=scl, freq=400000) lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS) lcd.clear() lcd.move_to(5,0) lcd.putstr("Howdy") utime.sleep(2)
py from machine import I2C, Pin from time import sleep from pico_i2c_lcd import I2cLcd i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000) I2C_ADDR = i2c.scan()[0] lcd = I2cLcd(i2c, I2C_ADDR, 2, 16) while True: print(I2C_ADDR) lcd.blink_cursor_on() lcd.putstr("I2C Address:"+str(I2C_ADDR)+"\n") lcd.putstr("Tom's Hardware") sleep(2) lcd.clear() lcd.putstr("I2C Address:"+str(hex(I2C_ADDR))+"\n") lcd.putstr("Tom's Hardware") sleep(2) lcd.blink_cursor_off() lcd.clear() lcd.putstr("Backlight Test") for i in range(10): lcd.backlight_on() sleep(0.2) lcd.backlight_off() sleep(0.2) lcd.backlight_on() lcd.hide_cursor() for i in range(20): lcd.putstr(str(i)) sleep(0.4) lcd.clear()
py from machine import I2C # type: ignore from machine import Pin as pin # type: ignore from lcd_api import LcdApi from pico_i2c_lcd import I2cLcd I2C_ADDR = 0x27 I2C_NUM_ROWS = 2 I2C_NUM_COLS = 16 i2c = I2C(0, sda=pin(0), scl=pin(1), freq=400000) lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS) lcd.putstr("hello world")