Hi ,
I am trying to with a button press change the number and display a different name on a lcd 16.2 I2c.
when i press the button it displays the name but doesn't display the default number. i would like it to display the number and the name ie 1 crunch, 2 lead, 3 drive, can someone tell me where i am going wrong.
Thank you
sorry wrong topic
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd (0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int button = 4;
int count = 0;
int upLastTime, downLastTime, upNow, downNow;
void setup() {
lcd.begin(16,2);
pinMode (button,INPUT_PULLUP);
}
void loop() {
upNow = digitalRead(button);
if (upNow == HIGH && upLastTime == LOW) {
lcd.setCursor(0,0);
lcd.print(count++);
switch (count) {
case 1:
lcd.setCursor(5,0);
lcd.print(" clean");
break;
case 2:
//lcd.clear();
lcd.setCursor(5,0);
lcd.print(" Crunch");
break;
case 3:
//lcd.clear();
lcd.setCursor(5,0);
lcd.print(" Lead");
break;
case 4:
lcd.clear();
lcd.setCursor(5,0);
lcd.print("Drive");
break;
case 5:
lcd.clear();
break;
}
delay(20); // bit of debounce delay
}
upLastTime= upNow;
}