Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- // initialize digital pin LED_BUILTIN as an output.
- pinMode(LED_BUILTIN, OUTPUT);
- pinMode(2, INPUT);
- pinMode(4, INPUT);
- pinMode(5, INPUT);
- pinMode(7, INPUT);
- pinMode(13, OUTPUT);
- }
- // the loop function runs over and over again forever
- void loop() {
- int i = 0;
- if(digitalRead(2) == HIGH)
- {
- i++;
- }
- if(digitalRead(4) == HIGH)
- {
- i++;
- }
- if(digitalRead(5) == HIGH)
- {
- i++;
- }
- if(digitalRead(7) == HIGH)
- {
- i++;
- }
- if(i>2)
- {
- digitalWrite(13, HIGH);
- }
- else
- {
- digitalWrite(13, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement