#include <LiquidCrystal.h>
// LCD pin mapping
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
// Custom fast write function
void fastPrint(LiquidCrystal &lcd, const char *str, uint8_t col, uint8_t row) {
lcd.setCursor(col, row);
while(*str) {
lcd.write(*str++); // Using write() instead of print() avoids string overhead
}
}
void setup() {
Serial.begin(115200);
lcd.begin(16, 2);
// Warm-up display
lcd.print("Initializing...");
delay(100);
lcd.clear();
}
void loop() {
static uint8_t counter = 0;
unsigned long start = micros();
// Update display
fastPrint(lcd, "Hello World!", 2, 0);
fastPrint(lcd, "> Pi Pico <", 2, 1);
// Show counter to verify updates
lcd.setCursor(14, 0);
lcd.write('0' + (counter++ % 10));
unsigned long elapsed = micros() - start;
Serial.print("Update time: ");
Serial.print(elapsed);
Serial.println(" µs");
delay(1000);
}