#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0X27,16,2);
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available())
{
String s=Serial.readString();
lcd.println(s);
lcd.setCursor(0,0);
}
}
/*
#include <Wire.h>
void setup() {
// Initialize I2C communication
Wire.begin();
// Initialize Serial communication
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop() {
// Main code to run repeatedly
byte errorCode;
int deviceCount = 0;
Serial.println("Scanning...");
for (int address = 1; address < 123; address++) {
Wire.beginTransmission(address);
errorCode = Wire.endTransmission();
if (errorCode == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address, HEX);
Serial.println(" !");
deviceCount++;
}
else if (errorCode == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address, HEX);
}
}
if (deviceCount == 0) {
Serial.println("No I2C device found\n");
}
else {
Serial.println("Done\n");
}
delay(5000);
}
*/