Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define greenLED A0
- #define redLED A1
- int button1 = 5;
- int button2 = 4;
- int button3 = 3;
- void setup() {
- // put your setup code here, to run once:
- pinMode(A0, OUTPUT);
- pinMode(A1, OUTPUT);
- pinMode(button1, INPUT_PULLUP);
- pinMode(button2, INPUT_PULLUP);
- pinMode(button3, INPUT_PULLUP);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- int total = 0;
- while(digitalRead(button1) == LOW && digitalRead(button2) == LOW && digitalRead(button3) == LOW){
- while(digitalRead(button1) == LOW && digitalRead(button2) == LOW && digitalRead(button3) == LOW){
- while(digitalRead(button1) == LOW && digitalRead(button2) == LOW && digitalRead(button3) == LOW){
- while(digitalRead(button1) == LOW && digitalRead(button2) == LOW && digitalRead(button3) == LOW){
- while(digitalRead(button1) == LOW && digitalRead(button2) == LOW && digitalRead(button3) == LOW){
- if(digitalRead(button1) == HIGH){
- total = total + 1;
- }
- }
- if(digitalRead(button2)==HIGH){
- total = total+1;
- }
- }
- if(digitalRead(button3)==HIGH){
- total = total + 1;
- }
- }
- if(digitalRead(button3)==HIGH){
- total = total+1;
- }
- }
- if(digitalRead(button1) == HIGH){
- total = total+1;
- }
- }
- if(total == 5){
- digitalWrite(A0, HIGH);
- delay(2000);
- digitalWrite(A0, LOW);
- }else{
- digitalWrite(A1, HIGH);
- delay(2000);
- digitalWrite(A1, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement