Created
June 22, 2014 21:50
-
-
Save vortec/42d4cc2eb312e95a2abf 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
/*int a = 11; // top | |
int b = 10; // top right | |
int c = 5; // bottom right | |
int d = 4; // bottom | |
int e = 3; // bottom left | |
int f = 12; // top left | |
int g = 13; // middle | |
int h = 6; // point | |
*/ | |
int pins[7] = { 11, 10, 5, 4, 3, 12, 13 }; | |
int point = 6; | |
byte digits[10][7] = { | |
{ 1, 1, 1, 1, 1, 1, 0 }, // 0 | |
{ 0, 1, 1, 0, 0, 0, 0 }, // 1 | |
{ 1, 1, 0, 1, 1, 0, 1 }, // 2 | |
{ 1, 1, 1, 1, 0, 0, 1 }, // 3 | |
{ 0, 1, 1, 0, 0, 1, 1 }, // 4 | |
{ 1, 0, 1, 1, 0, 1, 1 }, // 5 | |
{ 1, 0, 1, 1, 1, 1, 1 }, // 6 | |
{ 1, 1, 1, 0, 0, 0, 0 }, // 7 | |
{ 1, 1, 1, 1, 1, 1, 1 }, // 8 | |
{ 1, 1, 1, 0, 0, 1, 1 } // 9 | |
}; | |
void loop() { | |
int wait = 1000; | |
for (int i=10; i > 0; i--) { | |
write_digit(i); | |
Serial.println("aaa"); | |
Serial.println(i); | |
delay(wait); | |
} | |
} | |
void write_digit(int digit) { | |
for (int i=0; i<7; i++) { | |
digitalWrite(pins[i], digits[digit][i]); | |
} | |
} | |
void setup() { | |
Serial.begin(9600); | |
for (int i=0; i<7; i++) { | |
pinMode(pins[i], OUTPUT); | |
} | |
pinMode(point, OUTPUT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment