Can someone help me how can I print the numbers on 16x2 lcd with out the decimal point. Im doing a countdown on my program thanks.
#include <LiquidCrystal.h>
//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // put your pin numbers here
void setup() {
lcd.begin(16,2);
// set cursor position to start of first line on the LCD
lcd.setCursor(0,0);
//text to print
delay(100);
float b=15;
while(b!=1)
{
b=b-1;
delay(1000);
lcd.setCursor(0,1);
lcd.print(" ");
lcd.print(b);
lcd.setCursor(0,0);
}
}
void loop()
{
}
When it reaches 9 the 9 becomes 90 the 8 becomes 80 the 7 becomes 70
You are not erasing the zero left by printing the 10
Options : always follow the printing of the number with a space or better, only do it if the number is less than 10. Actually, only doing it when the number is 9 would work, or always print spaces where you will be printing the number. The sledgehammer (and worst) way to do it is to clear the LCD completely before printing the number
UKHeliBob:
You are not erasing the zero left by printing the 10
Options : always follow the printing of the number with a space or better, only do it if the number is less than 10. Actually, only doing it when the number is 9 would work, or always print spaces where you will be printing the number. The sledgehammer (and worst) way to do it is to clear the LCD completely before printing the number
Thanks so much UKHeliBob that was great suggestion