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"); lcd.print("Distance in cm");
} }
void loop() void loop()
{ {
lcd.setCursor(0,1); lcd.setCursor(0,1);
lcd.print(" "); char cm[3];
lcd.setCursor(0,1); sprintf(cm, "%.3i", sonar.ping_cm());
lcd.print(sonar.ping_cm()); lcd.print(cm);
delay(50); delay(50);
} }