One Button program for different uses.
Hi friends,
Being a newbie means I have to be humble and ask for help from time to time.
I'm trying to write code for a two button set up, high/low, which are used to change their values in memory. I press either button 3 seconds to enter setup. Once I'm in set up, the same two buttons are inputs to change their respective values in memory. I press the high button 3 seconds enter setup, then the high button increments the H value, and the low button decrements the H value. Likewise, when I press the low button 3 seconds, I enter low value setup, high button increments the low value while low button decrements the low value. If I hold a button down, I want the value to increase/decrease until I reach the desired value.
(forgive me for not following protocol with brackets, I'm still not too good at it)
Code:
if (button4 == HIGH)
{
tick1 = tick1++; //wait 3 seconds then enter setup.
if(tick1 = 65000){
delay(300);
tick1 == 0; //reset timer
if(button4 == HIGH){
lset == lset--; //decrement low value, write it in memory
EEPROM.write(11, lset);
//here I want to loop back to button4 to decrement again as needed.
}
else if(button3 == HIGH){
lset == lset++; //increment low value and write it down
delay(300);
EEPROM.write(11, lset);
//here I want to loop back to button3 to increment again as needed.
}
}
}