Code
Code
// Set the LCD's I2C address, number of columns, and number of rows
// You NEED to change the address (0x27) if yours is different!
// Common addresses are 0x27 and 0x3F
// Change 16 and 2 to match your LCD (e.g., 20, 4 for a 20x4 LCD)
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// --- HC-SR04 Setup ---
pinMode(trigPin, OUTPUT); // Set the trigger pin as an output
pinMode(echoPin, INPUT); // Set the echo pin as an input