Created
December 26, 2014 00:29
-
-
Save gazolla/1ac50528ecb46459b137 to your computer and use it in GitHub Desktop.
Arduino Multi function shield - Switches example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const byte LED[] = {13,12,11,10}; | |
#define BUTTON1 A1 | |
#define BUTTON2 A2 | |
void setup() | |
{ | |
// initialize the digital pin as an output. | |
/* Set each pin to outputs */ | |
pinMode(LED[0], OUTPUT); | |
pinMode(LED[1], OUTPUT); | |
pinMode(LED[2], OUTPUT); | |
pinMode(LED[3], OUTPUT); | |
} | |
void loop() | |
{ | |
if(!digitalRead(BUTTON1)) | |
{ | |
digitalWrite(LED[0], HIGH); | |
digitalWrite(LED[1], HIGH); | |
digitalWrite(LED[2], HIGH); | |
digitalWrite(LED[3], HIGH); | |
} | |
if(!digitalRead(BUTTON2)) | |
{ | |
digitalWrite(LED[0], LOW); | |
digitalWrite(LED[1], LOW); | |
digitalWrite(LED[2], LOW); | |
digitalWrite(LED[3], LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment