Hi all!
I using arduino mega 2560 + lcd keypad shield df robot
I have a variable HighTemp
HighTemp = 70
I print it on LCD
Now, how to click button select to value 70 flashing and click button up to HighTemp=HighTemp++ and click button down to HighTemp=HighTemp-- and value 70 change over button. Then click button select to exit change
Please help me
Use a state machine:
enum states {NORMAL, SELECTED} State = NORMAL;
void loop() {
int button = whichever button is pressed;
switch (State) {
case NORMAL:
if (button == SELECT)
State = SELECTED;
break;
case SELECTED:
if (button == UP)
HighTemp++;
else
if (button == DOWN)
HighTemp--;
// use BlinkWithoutDelay technique to blink the display
if (button == SELECT) {
Dispay the new value
State = NORMAL;
}
break;
}
}