Advertisement
Guest User

Untitled

a guest
May 25th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. //Logan Aker
  2. //Object, Summer 2019
  3. //05/14/19
  4. //Digital I/O
  5.  
  6. const int button1Pin = 2;
  7. const int button2Pin = 3;
  8. const int ledPin = 13;
  9.  
  10. void setup()
  11. {
  12. pinMode(button1Pin, INPUT);
  13. pinMode(button2Pin, INPUT);
  14.  
  15. pinMode(ledPin, OUTPUT);
  16. }
  17.  
  18. void loop()
  19. {
  20. int button1State, button2State;
  21.  
  22. button1State = digitalRead(button1Pin);
  23. button2State = digitalRead(button2Pin);
  24.  
  25. if (((button1State == LOW) || (button2State == LOW))
  26. && !
  27. ((button1State == LOW) && (button2State == LOW)))
  28. {
  29. digitalWrite(ledPin, HIGH); // turn the LED on
  30. }
  31. else
  32. {
  33. digitalWrite(ledPin, LOW); // turn the LED off
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement