[SOLVED]Clock Set mode issue - capacitive sensors
hi all,
i've been working on clock , works except 'set mode' delay have implemented. reason button_delay holds , enters set mode when tapping capacitive button, not want. it needs cancel if tap unintended. the capacitive button not hanging though, when monitoring values via serial, responds quickly, , reacts expected when enters 'set mode'. any appreciated
full code attached
i've been working on clock , works except 'set mode' delay have implemented. reason button_delay holds , enters set mode when tapping capacitive button, not want. it needs cancel if tap unintended. the capacitive button not hanging though, when monitoring values via serial, responds quickly, , reacts expected when enters 'set mode'. any appreciated
code: [select]
void longpressset(){
long total3 = setsensor.capacitivesensor(2);
serial.println(total3);
if (total3 > 70){
buttonstateset = high;
}
else {buttonstateset = low;}
buttonstateset = buttonstateset;
while (buttonstateset == high && button_delay < 20 && setstate == 0){
delay (100);
button_delay++;
serial.println(button_delay);
if (button_delay == 10){
sevseg.setnumber((hour)*100,2); //displays time
sevseg.refreshdisplay();
delay (1000);
setstate = 1;
}
else
{
setstate = 0;
}
}
}
full code attached
nevermind, have found solution problem
code: [select]
void longpressset(){
long total3 = setsensor.capacitivesensor(2);
int button_delay = 0;
while (total3 > 70 && button_delay < 20 && setstate == 0){
delay (100);
long total3 = setsensor.capacitivesensor(2);
button_delay++;
if (button_delay == 10 && total3 > 70){
sevseg.setnumber((hour)*100,2); //displays time
sevseg.refreshdisplay();
delay (1000);
setstate = 1;
}
else
{
setstate = 0;
}
}
}
Arduino Forum > Using Arduino > Programming Questions > [SOLVED]Clock Set mode issue - capacitive sensors
arduino
Comments
Post a Comment