3leds 1 button help me finish | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

3leds 1 button help me finish

I need help to finish this project: This is the circuit-http://prntscr.com/rqx9gk This is my unfinished code - http://prntscr.com/rqxaqw I need help with the code so the three leds(green,red,blue) work only when the first led(yellow) is ON. Some variables are named in my native language so if you dont understand just ask I will try to translate it or use google translate from slovak to english it should work just fine. Thanks for all your help in advance.

1st Apr 2020, 3:12 PM
David
David - avatar
7 Answers
+ 6
Thanks for mentioning me. Gordon
1st Apr 2020, 4:19 PM
Pedro H.J
Pedro H.J - avatar
+ 4
David, I would make something like this int block =0; void loop( ){ if(digitalRead(button)== true && block ==1) { count++; block=0; delay(50); } if(digitalRead(button)==false) block=0; // use Switch case // to do what you want here switch(count){ case:0 // do something break; case:1 // do something break; //...... } }
1st Apr 2020, 4:17 PM
Pedro H.J
Pedro H.J - avatar
+ 1
This is a warning to your repeated offense of posting "laziness" question in SoloLearn Q&A. https://www.sololearn.com/Discuss/2222839/?ref=app
1st Apr 2020, 3:15 PM
Gordon
Gordon - avatar
+ 1
I see your screenshot of your attempt now. Now it is eligible for answering, I withdraw my previous warning. Instead of using a screenshot, use code playground : Please show your code here so that we can help you https://www.sololearn.com/post/75089/?ref=app
1st Apr 2020, 3:55 PM
Gordon
Gordon - avatar
+ 1
arduino, so maybe... Pedro H.J ?
1st Apr 2020, 3:57 PM
Gordon
Gordon - avatar
0
Man I need help what do you mean "laziness".Where should I post this then if not here
1st Apr 2020, 3:22 PM
David
David - avatar
1st Apr 2020, 4:16 PM
David
David - avatar