Created
June 8, 2015 17:41
-
-
Save zxmarcos/f8becd3c4a6f87869a4f 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
| #define VERMELHO 9 | |
| #define AMARELO 10 | |
| #define VERDE 11 | |
| int numeros[10][7] = | |
| { | |
| // A B C D E F G | |
| { 1, 1, 1, 1, 1, 1, 0 }, // Num 0 | |
| { 0, 1, 1, 0, 0, 0, 0 }, // Num 1 | |
| { 1, 1, 0, 1, 1, 0, 1 }, // Num 2 | |
| { 1, 1, 1, 1, 0, 0, 1 }, // Num 3 | |
| { 0, 1, 1, 0, 0, 1, 1 }, // Num 4 | |
| { 1, 0, 1, 1, 0, 1, 1 }, // Num 5 | |
| { 1, 0, 1, 1, 1, 1, 1 }, // Num 6 | |
| { 1, 1, 1, 0, 0, 0, 0 }, // Num 7 | |
| { 1, 1, 1, 1, 1, 1, 1 }, // Num 8 | |
| { 1, 1, 1, 0, 0, 1, 1 }, // Num 9 | |
| }; | |
| int portas[7] = { | |
| // A B C D E F G | |
| 6,5,2,3,4,7,8 | |
| }; | |
| void exibir_numero(int num) | |
| { | |
| if (num < 10) { | |
| int i = 0; | |
| while (i < 7) { | |
| int porta = portas[i]; | |
| if (numeros[num][i] == 1) { | |
| // Acender o LED | |
| digitalWrite(porta, HIGH); | |
| } else { | |
| // Apagar o LED | |
| digitalWrite(porta, LOW); | |
| } | |
| i++; | |
| } | |
| } | |
| } | |
| void setup() { | |
| int i = 2; | |
| while (i < 9) { | |
| pinMode(i, OUTPUT); | |
| digitalWrite(i, HIGH); | |
| i++; | |
| } | |
| Serial.begin(9600); | |
| } | |
| void loop() { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment