Update with leading zeroes, instead of clearing

This commit is contained in:
Daniel Løvbrøtte Olsen 2016-04-14 03:32:36 -04:00
parent d9cf8173ac
commit d92c0c0130

View File

@ -23,11 +23,13 @@ void setup()
lcd.print("Distance in cm");
}
void loop()
{
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(sonar.ping_cm());
char cm[3];
sprintf(cm, "%.3i", sonar.ping_cm());
lcd.print(cm);
delay(50);
}