# i2c_lcd-menue.py # LCD 1602 Display mit Contoller HD44780 # und I2C-Controller LCM 1602 (PCF8574 IO Expansion Board I2C) import network, time from machine import Pin, I2C from lcd_api import LcdApi from i2c_lcd import I2cLcd I2C_ADDR = 0x27 totalRows = 2 # zwei Zeilen totalColumns = 16 # 16 Zeichen je Zeile SDA_Pin = 4 # GPIO4 - D14/SDA - gelb - SDA SCL_Pin = 5 # GPIO5 - D15/SCL - orange - SCL i2c = I2C(scl=Pin(SCL_Pin), sda=Pin(SDA_Pin), freq=10000) lcd = I2cLcd(i2c, I2C_ADDR, totalRows, totalColumns) lcd.clear() lcd.putstr("I2C LCD 2x16") time.sleep(2) lcd.move_to(0,1) # Zeichen 0, Zeile 2 lcd.putstr(str(14)+":"+str(7)) time.sleep(2) lcd.move_to(10,1) # Zeichen 10, Zeile 2 happy_face = bytearray([0x00, 0x0A, 0x00, 0x04, 0x00, 0x11, 0x0E, 0x00]) lcd.custom_char(0, happy_face) lcd.putchar(chr(0)) time.sleep(2) # https://www.python-kurs.eu/python3_formatierte_ausgabe.php print(time.localtime()) print(time.localtime()[3]) print("%02d:%02d:%02d"% (time.localtime()[3],time.localtime()[4],time.localtime()[5])) uhrzeit = "| {0:02d}:{1:02d}:{2:02d} |".format(time.localtime()[3],time.localtime()[4],time.localtime()[5]) print(uhrzeit) time.sleep(2) lcd.move_to(0,1) # Zeichen 0, Zeile 2 lcd.putstr(uhrzeit) ap = network.WLAN(network.AP_IF) print(ap.ifconfig()) wlan = network.WLAN(network.STA_IF) print(wlan.ifconfig())