Hi Robin2.
what you are talking about is what i am looking for, i would just like to se the code in practical use, i have been searching in forum, playground and google, but i haven't found anything i could study and convert for my project.
i have had some other IT issues, but i came up with another solution, pushbutton counters and a lot of if if to modify thresholds.
// read the pushbutton input pin:
buttonState1 = digitalRead(buttonPin1);
// compare the buttonState to its previous state
if (buttonState1 != lastButtonState1) {
// if the state has changed, increment the counter
if (buttonState1 == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter1++;
Serial.print("number of button1 pushes: ");
Serial.println(buttonPushCounter1);
}
}
lastButtonState1 = buttonState1;
// read the pushbutton input pin:
buttonState2 = digitalRead(buttonPin2);
// compare the buttonState to its previous state
if (buttonState2 != lastButtonState2) {
// if the state has changed, increment the counter
if (buttonState2 == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter2++;
Serial.print("number of button2 pushes: ");
Serial.println(buttonPushCounter2);
}
}
lastButtonState2 = buttonState2;
// read the pushbutton input pin:
buttonState3 = digitalRead(buttonPin3);
// compare the buttonState to its previous state
if (buttonState3 != lastButtonState3) {
// if the state has changed, increment the counter
if (buttonState3 == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter3++;
Serial.print("number of button3 pushes: ");
Serial.println(buttonPushCounter3);
}
}
lastButtonState3 = buttonState3;
// function for setting threshold 1
if (buttonPushCounter1 == 1) {
if (buttonPushCounter2 == 1){
threshold1= threshold1 + 1;
}}
if (buttonPushCounter1 == 1) {
if (buttonPushCounter3 == 1){
threshold1 = threshold1 - 1;
}}
// function for setting threshold 2
if (buttonPushCounter1 == 2) {
if (buttonPushCounter2 == 1){
threshold2= threshold2 + 1;
}}
if (buttonPushCounter1 == 2) {
if (buttonPushCounter3 == 1){
threshold2 = threshold2 - 1;
}}
// function for setting threshold 3
if (buttonPushCounter1 == 3) {
if (buttonPushCounter2 == 1){
threshold3= threshold3 + 1;
}}
if (buttonPushCounter1 == 3) {
if (buttonPushCounter3 == 1){
threshold3 = threshold3 - 1;
}}
// function for setting threshold 4
if (buttonPushCounter1 == 4) {
if (buttonPushCounter2 == 1){
threshold4= threshold4 + 1;
}}
if (buttonPushCounter1 == 4) {
if (buttonPushCounter3 == 1){
threshold4 = threshold4 - 1;
}}
if (buttonPushCounter1 >= 5){
buttonPushCounter1 = 0;
}
if (buttonPushCounter2 == 1){
buttonPushCounter2=0;
}
if (buttonPushCounter3 == 1){
buttonPushCounter3=0;
}
it is not as fancy but it can do the job, the downsides is that values isn't stored in EEPROM, and i can't see on display what i am doing, and there is a lot of code.
finally i got some really helpfull exampless on LCD menus and saving values to EEPROM on another forum, so now i got something to study.
BR Søren.