David Ames
/
myflashy
Dual Digit 7 Segment Display
main.cpp@0:71cc75eb9510, 2010-10-11 (annotated)
- Committer:
- amos
- Date:
- Mon Oct 11 22:09:37 2010 +0000
- Revision:
- 0:71cc75eb9510
- Child:
- 1:4d9d638b8e3f
Initial connection to a dual digit 7 segment display (left digit only so far)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
amos | 0:71cc75eb9510 | 1 | #include "mbed.h" |
amos | 0:71cc75eb9510 | 2 | |
amos | 0:71cc75eb9510 | 3 | DigitalOut myPins[] = {p7, p8, p9, p10, p11, p12, p13}; |
amos | 0:71cc75eb9510 | 4 | |
amos | 0:71cc75eb9510 | 5 | /* |
amos | 0:71cc75eb9510 | 6 | int zero[] = {0, 0, 0, 1, 0, 0, 0}; |
amos | 0:71cc75eb9510 | 7 | int one[] = {0, 1, 1, 1, 1, 1, 0}; |
amos | 0:71cc75eb9510 | 8 | int two[] = {1, 0, 0, 0, 0, 1, 0}; |
amos | 0:71cc75eb9510 | 9 | int three[] = {0, 1, 0, 0, 0, 1, 0}; |
amos | 0:71cc75eb9510 | 10 | int four[] = {0, 1, 1, 0, 1, 0, 0}; |
amos | 0:71cc75eb9510 | 11 | int five[] = {0, 1, 0, 0, 0, 0, 1}; |
amos | 0:71cc75eb9510 | 12 | int six[] = {0, 0, 0, 0, 0, 0, 1}; |
amos | 0:71cc75eb9510 | 13 | int seven[] = {0, 1, 1, 1, 0, 1, 0}; |
amos | 0:71cc75eb9510 | 14 | int eight[] = {0, 0, 0, 0, 0, 0, 0}; |
amos | 0:71cc75eb9510 | 15 | int nine[] = {0, 1, 0, 0, 0, 0, 0}; |
amos | 0:71cc75eb9510 | 16 | */ |
amos | 0:71cc75eb9510 | 17 | |
amos | 0:71cc75eb9510 | 18 | int numb[10][7] = {{0, 0, 0, 1, 0, 0, 0}, |
amos | 0:71cc75eb9510 | 19 | {0, 1, 1, 1, 1, 1, 0}, |
amos | 0:71cc75eb9510 | 20 | {1, 0, 0, 0, 0, 1, 0}, |
amos | 0:71cc75eb9510 | 21 | {0, 1, 0, 0, 0, 1, 0}, |
amos | 0:71cc75eb9510 | 22 | {0, 1, 1, 0, 1, 0, 0}, |
amos | 0:71cc75eb9510 | 23 | {0, 1, 0, 0, 0, 0, 1}, |
amos | 0:71cc75eb9510 | 24 | {0, 0, 0, 0, 0, 0, 1}, |
amos | 0:71cc75eb9510 | 25 | {0, 1, 1, 1, 0, 1, 0}, |
amos | 0:71cc75eb9510 | 26 | {0, 0, 0, 0, 0, 0, 0}, |
amos | 0:71cc75eb9510 | 27 | {0, 1, 0, 0, 0, 0, 0}}; |
amos | 0:71cc75eb9510 | 28 | |
amos | 0:71cc75eb9510 | 29 | int main() |
amos | 0:71cc75eb9510 | 30 | { |
amos | 0:71cc75eb9510 | 31 | for(int i = 0; i < 7; i++) |
amos | 0:71cc75eb9510 | 32 | { |
amos | 0:71cc75eb9510 | 33 | myPins[i] = 1; |
amos | 0:71cc75eb9510 | 34 | } |
amos | 0:71cc75eb9510 | 35 | while(1) |
amos | 0:71cc75eb9510 | 36 | { |
amos | 0:71cc75eb9510 | 37 | for(int k = 0; k < 10; k++) |
amos | 0:71cc75eb9510 | 38 | { |
amos | 0:71cc75eb9510 | 39 | for(int i = 0; i < 7; i++) |
amos | 0:71cc75eb9510 | 40 | { |
amos | 0:71cc75eb9510 | 41 | myPins[i] = numb[k][i]; |
amos | 0:71cc75eb9510 | 42 | } |
amos | 0:71cc75eb9510 | 43 | wait(1); |
amos | 0:71cc75eb9510 | 44 | } |
amos | 0:71cc75eb9510 | 45 | } |
amos | 0:71cc75eb9510 | 46 | } |
amos | 0:71cc75eb9510 | 47 | |
amos | 0:71cc75eb9510 | 48 |