Last active
December 27, 2015 20:59
-
-
Save flyingoctopus/7388976 to your computer and use it in GitHub Desktop.
even simpler
This file contains 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
int pinCount = 4; // the number of pins | |
int thisPin; | |
void setup() { // set up the app | |
for (int thisPin = 1; thisPin <= pinCount ; thisPin++) { | |
setupPin(thisPin); | |
} | |
} | |
void loop() | |
{ | |
for (int thisPin = 1; thisPin <= pinCount; thisPin++) { | |
turnOnPin(thisPin); | |
delay(300); | |
turnOffPin(thisPin); | |
} | |
} | |
void setupPin(int i) { | |
switch(i) { | |
case 1: | |
pinMode(A5, OUTPUT); | |
break; | |
case 2: | |
pinMode(A2, OUTPUT); | |
break; | |
case 3: | |
pinMode(10, OUTPUT); | |
break; | |
case 4: | |
pinMode(5, OUTPUT); | |
break; | |
} | |
} | |
void turnOnPin(int i) { | |
switch(i) { | |
case 1: | |
digitalWrite(5, HIGH); | |
break; | |
case 2: | |
digitalWrite(10, HIGH); | |
break; | |
case 3: | |
digitalWrite(A2, HIGH); | |
break; | |
case 4: | |
digitalWrite(A5, HIGH); | |
break; | |
} | |
} | |
void turnOffPin(int i) { | |
switch(i) { | |
case 1: | |
digitalWrite(5, LOW); | |
break; | |
case 2: | |
digitalWrite(10, LOW); | |
break; | |
case 3: | |
digitalWrite(A2, LOW); | |
break; | |
case 4: | |
digitalWrite(A5, LOW); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment