When I run this program the distance value is displayed only in the first column.
Running the same program on the same type display without the I2C works correctly.
Can you help me correct this?
Thank you in advance.
Ed
// LCD_I2C-text-distance
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#include <NewPing.h>
#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define MAX_DISTANCE 200
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
void setup() {
lcd.begin(16,2);
lcd.init();
lcd.backlight();
lcd.print("Distance cm");
}
void loop() {
delay(50);
unsigned int uS = sonar.ping_cm();
unsigned int D = uS/US_ROUNDTRIP_CM;
lcd.setCursor(0,1);
lcd.print(D);
}