I have a project and I need 2 button pressed at the same time to enter a code to turn on a led. How will I do that?
I cant seem to figure out how to press 2 buttons at the same time to print on my lcd. No one can press 2 buttons at the same exact time so do I:
//Un tested code
if(button1 == high){
while(button2 == HIGH){ //wait for button 2 to also be high
digitalWrite(LED1,HIGH);
}
}
All I need is an idea or some way to turn on an led by pressing 2 buttons at the same time.
Thanks for reading!
if (button1 == HIGH && button2 == HIGH)
// Both buttons are HIGH
1 Like
I tryed that and it didnt work last time now it did 
Thanks!!!
LOL!
Let's hope it works next time. Musta been the phase of the Moon or something.
a7
As a poor mans switch bounce routing I usually use this code approach
if (button1 == HIGH && button2 == HIGH){
delay(100);
if (button1 == HIGH && button2 == HIGH){
put your code within these braces
}
}
Normally a switch will stop bouncing at around 50ms. A delay of 100 ms when it comes to hand operated switches is not noticeable.
1 Like
system
Closed
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.