1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| // Chiffres de 0 à 9 du score *****************************************
uint16_t Chiffre[10]= {111101101101111,010110010010111,111001111100111,111001011001111,
100101111001001,111100111001111,111100111101111,
111001001001001,111101111101111, 111101111001111};
byte rows[8] = {9, 14, 8, 12, 1, 7, 2, 5};
byte cols[8] = {13, 3, 4, 10, 6, 11, 15, 16};
byte pins[16] = {5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6};
byte screen[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int sG = 0; // score du joueur gauche
int sD = 0; // score du joueur droit
void setup() {
Serial.begin(9600);
for (int i = 0; i < 8; i++) {
screen[i] = B11111111;
delay(25);
}
for (int i = 0; i < 8; i++) {
screen[i] = B00000000;
delay(25);
}
}
void loop() {
int tempo = 250 ;
score(Chiffre,1000);
delay(tempo);
}
// Affichage du score
void score(uint16_t * image, unsigned long duree) {
unsigned long debut = millis();
//Serial.println(Chiffre[sG]);
for (int i = 0; i < 8; i++) screen[i] = 0;
for(int rows = 0; rows < 5; rows++){
for(int cols = 0; cols < 3; cols++){
boolean pixel = bitRead(image[0]*3,cols);
if (pixel == 1){
on(rows,cols);
}
}
}
}
void on(byte row, byte column) {
screen[column-1] |= (B1<<(row-1));
} |
Partager