Created
October 10, 2015 23:54
-
-
Save tnoborio/f38fbeaf593bcb773976 to your computer and use it in GitHub Desktop.
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 int a = 11; | |
const int b = 7; | |
const int c = 4; | |
const int d = 2; | |
const int e = 1; | |
const int f = 10; | |
const int g = 5; | |
const int p = 3; | |
const int d1 = 12; | |
const int d2 = 9; | |
const int d3 = 8; | |
const int d4 = 6; | |
const boolean isAnode = true; | |
void setup() { | |
for (int i = 1; i <= 12; i = i + 1) { | |
pinMode(i, OUTPUT); | |
} | |
} | |
void on(int pin) { | |
if (isAnode) { | |
digitalWrite(pin, HIGH); | |
} else { | |
digitalWrite(pin, LOW); | |
} | |
} | |
void off(int pin) { | |
if (isAnode) { | |
digitalWrite(pin, LOW); | |
} else { | |
digitalWrite(pin, HIGH); | |
} | |
} | |
void reset(int digiPin) { | |
off(d1); | |
off(d2); | |
off(d3); | |
off(d4); | |
on(digiPin); | |
on(a); | |
on(b); | |
on(c); | |
on(d); | |
on(e); | |
on(f); | |
on(g); | |
on(p); | |
} | |
void loop() { | |
reset(d4); | |
off(a); | |
off(b); | |
off(c); | |
off(d); | |
off(e); | |
off(f); | |
off(g); | |
delay(4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment