from machine import Pin, I2C
import utime
# Define I2C pins
i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=400000)
# PCF8574 I2C address
PCF8574_ADDR = 0x27
# LCD commands
LCD_CLEAR = 0x01
LCD_RETURN_HOME = 0x02
LCD_ENTRY_MODE_SET = 0x04
LCD_DISPLAY_CONTROL = 0x08
LCD_FUNCTION_SET = 0x20
LCD_SET_DDRAM_ADDR = 0x80
# LCD flags
LCD_DISPLAY_ON = 0x04
void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Serial1.println("Hello, Raspberry Pi Pico!");
// Init
lcd.init();
lcd.backlight();
// Print something
lcd.setCursor(3, 0);
lcd.print("Hello, world!");
lcd.setCursor(2, 1);
lcd.print("Wokwi Online IoT");
lcd.setCursor(5, 2);
lcd.print("Simulator");
lcd.setCursor(7, 3);
lcd.print("Enjoy!");
Serial1.println("Hello, Raspberry Pi Pico!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(1); // this speeds up the simulation
}