Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement