#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600); // Initialize serial communications
lcd.begin(16,2);
lcd.backlight();
lcd.setCursor(0, 0);
printCen("S5 EEE");
lcd.setCursor(0, 1);
printCen("Place ID Card");
}
void loop() {
// Your loop code (if needed)
}
void printCen(String text) {
if (text.length() > 16) {
text = text.substring(0, 16); // Truncate text to fit the display
}
int spaces = (16 - text.length()) / 2;
for (int i = 0; i < spaces; i++) {
lcd.print(" ");
}
lcd.print(text);
}