Hey everyone, noob here trying to code something been trying other peoples similar codes for hours with no luck
To start my project since I'm a noob I broke it up into parts:
#1. change page text on the screen with a push of a tect switch
page-1 text: FIRST + number between 0-100 which I would later like to adjust with a potentiometer or 2 up/down buttons
page-2 text: SECOND + number between 0-100 which I would later like to adjust with a potentiometer or 2 up/down buttons
page-3 text: THIRD + number between 0-100 which I would later like to adjust with a potentiometer or 2 up/down buttons
Once I figure that part out hopefully with someones help here I than would like to:
#2. use a potentiometer or 2 up/down buttons to change a value 0-100 #3. save new value to eeprom
#1. change page text on the screen with a push of a tect switch
The state change detection example shows how to determine that a switch has become pressed, and how to count the number of times that that happens.
Drawing page n should really be a no-brain-er, if you can make ANYTHING appear in the display.
Making the text for that page consist of some literal string concatenated with the string representation of a number is what sprintf() was invented for.
Hey I actually figured out state change and how to put the text on the screen on all 3 pages.
I also finished #2, using a pot to read a value 0-1023 and then mapped it to 0-100
I'm using code below to switch between pages, is there any way to make it switch page if the button is only clicked, but if it's held for over 2000ms make it do something else, like save to eeprom?
buttonPoll = digitalRead(button);
if(buttonPoll == 1) {
delay(50);
state = old + 1;
}
is there any way to make it switch page if the button is only clicked, but if it's held for over 2000ms make it do something else
Yes. You have to record when the switch becomes pressed and when it becomes released. If the interval is small, do one thing. If the interval is long, do something else.