Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Logan Aker
- //Object, Summer 2019
- //05/14/19
- //Digital I/O
- const int button1Pin = 2;
- const int button2Pin = 3;
- const int ledPin = 13;
- void setup()
- {
- pinMode(button1Pin, INPUT);
- pinMode(button2Pin, INPUT);
- pinMode(ledPin, OUTPUT);
- }
- void loop()
- {
- int button1State, button2State;
- button1State = digitalRead(button1Pin);
- button2State = digitalRead(button2Pin);
- if (((button1State == LOW) || (button2State == LOW))
- && !
- ((button1State == LOW) && (button2State == LOW)))
- {
- digitalWrite(ledPin, HIGH); // turn the LED on
- }
- else
- {
- digitalWrite(ledPin, LOW); // turn the LED off
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement