Last active
November 3, 2015 22:25
-
-
Save delta-G/43685615ed0e5a6e527e to your computer and use it in GitHub Desktop.
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
byte digits[] = {0b1111110 , 0b0110000, 0b1101101, 0b1111001, 0b0110011, 0b1011011, 0b1011111, 0b1110000, 0b1111111, 0b1111011}; | |
// pins to segments g,f,e,d,c,b,a | |
byte pins[] = {3,4,5,6,7,8,9}; | |
void displayNumber(int aNumber) { | |
for (int i = 0; i < 7; i++) { | |
digitalWrite(pins[i], digits[aNumber] & (1 << i)); | |
} | |
} | |
void setup(){ | |
for (int i = 0; i < 7; i++){ | |
pinMode(pins[i], OUTPUT); | |
} | |
} | |
void loop(){ | |
for (int i = 0; i < 10; i++) { | |
displayNumber(i); | |
delay(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment