Étape 5: Sketch Arduino
/*
CRÉÉ par ERANGA GAMAGEDARA IN SRI LANKA Courriel : developer.eranga * / int a = 13 ; int b = 8 ; int c = 6 ; int d = 5 ; int e = 4 ; int f = 3 ; int g = 9 ;
int D1 = 2 ; int D2 = 11 ; int D3 = 12 ; int D4 = 10 ;
int def [] = {1,1,1,1,1,1,1} ;
lettre int [8] = {} ;
int n1 [] = {0,0,1,1,1,1,1} ; int n2 [] = {0,1,0,0,1,0,0} ; int n3 [] = {0,0,0,1,1,0,0} ; int n4 [] = {0,0,1,1,0,1,0} ; int n5 [] = {1,0,0,1,0,0,0} ; int n6 [] = {1,0,0,0,0,0,0} ; int n7 [] = {0,0,1,1,0,0,1} ; int n8 [] = {0,0,0,0,0,0,0} ; int n9 [] = {0,0,0,1,0,0,0} ; int n0 [] = {0,0,0,0,0,0,1} ;
int LA [] = {0,0,1,0,0,0,0} ; int LB [] = {0,0,0,0,0,0,0} ; int LC [] = {1,1,0,0,0,0,1} ; int LD [] = {0,0,0,0,1,1,0} ; int LE [] = {1,1,0,0,0,0,0} ; int LF [] = {1,1,1,0,0,0,0} ; int LG [] = {0,0,0,1,0,0,0} ; int LH [] = {1,0,1,0,0,0,0} ; int LI [] = {1,1,1,0,0,1,1} ; int LJ [] = {0,0,0,1,1,1,1} ; int LK [] = {0,0,1,0,0,1,0} ; int LL [] = {1,1,0,0,0,1,1} ; int LM [] = {1,0,1,0,1,1,0} ; int LN [] = {1,0,1,0,1,1,0} ; int LO [] = {1,0,0,0,1,1,0} ; int LP [] = {0,1,1,0,0,0,0} ; int LQ [] = {0,0,1,1,0,0,0} ; int LR [] = {0,0,1,0,0,0,0} ; int LS [] = {1,0,0,1,0,0,0} ; int LT [] = {1,1,1,0,0,0,1} ; int LU [] = {0,0,0,0,0,1,1} ; int LV [] = {0,0,0,0,0,1,1} ; int LW [] = {0,0,0,0,0,1,1} ; [] int LX = {1,0,1,0,0,0,0} ; int LY [] = {0,0,0,1,0,1,0} ; int LZ [] = {0,1,0,0,1,0,0} ;
void setup() {}
pinMode(a,OUTPUT) ; pinMode(b,OUTPUT) ; pinMode(c,OUTPUT) ; pinMode(d,OUTPUT) ; pinMode(e,OUTPUT) ; pinMode(f,OUTPUT) ; pinMode(g,OUTPUT) ;
pinMode(D1,OUTPUT) ; pinMode(D2,OUTPUT) ; pinMode(D3,OUTPUT) ; pinMode(D4,OUTPUT) ; Serial.Begin(9600) ; }
void loop() {}
Printer("1234567890") ;
} void imprimante (String str) {si (str.length() < = 4) {showDigit(D1,str[0]) ; showDigit(D2,str[1]) ; showDigit(D3,str[2]) ; showDigit(D4,str[3]);} else {wordShifter(str);}} void wordShifter(String str) {}
int i = 0 ; tandis que (i
void getPattern (char s) {interrupteur (s) {case « 1 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n1 [j];} break ; case « 2 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n2 [j];} break ; case « 3 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n3 [j];} break ; case « 4 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n4 [j];} break ; case « 5 » : pour (int j = 0; j < 7; j ++) {lettre [j] = n5 [j];} break ; affaire « 6 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n6 [j];} break ; affaire « 7 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n7 [j];} break ; affaire « 8 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n8 [j];} break ; affaire « 9 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n9 [j];} break ; case « 0 »: pour (int j = 0; j < 7; j ++) {lettre [j] = n0 [j];} break ; affaire « A »: pour (int j = 0; j < 7; j ++) {lettre [j] = LA [j];} break ; affaire « B »: pour (int j = 0; j < 7; j ++) {lettre [j] = LB [j];} break ; case « C »: pour (int j = 0; j < 7; j ++) {lettre [j] = LC [j];} break ; affaire aurait ": pour (int j = 0; j < 7; j ++) {lettre [j] = LD [j];} break ; case « E »: pour (int j = 0; j < 7; j ++) {lettre [j] = LE [j];} break ; case « F »: pour (int j = 0; j < 7; j ++) {lettre [j] = LF [j];} break ; case « G »: pour (int j = 0; j < 7; j ++) {lettre [j] = LG [j];} break ; case « H »: pour (int j = 0; j < 7; j ++) {lettre [j] = LH [j];} break ; « I » affaire : pour (int j = 0; j < 7; j ++) {lettre [j] = LI [j];} break ; affaire « J »: pour (int j = 0; j < 7; j ++) {lettre [j] = LJ [j];} break ; case « K »: pour (int j = 0; j < 7; j ++) {lettre [j] = LK [j];} break ; case « L »: pour (int j = 0; j < 7; j ++) {lettre [j] = LL [j];} break ; cas suis ': pour (int j = 0; j < 7; j ++) {lettre [j] = LM [j];} break ; cas ' n ': pour (int j = 0; j < 7; j ++) {lettre [j] = LN [j];} break ; cas ' o ': pour (int j = 0; j < 7; j ++) {lettre [j] = LO [j];} break ; affaire « P »: pour (int j = 0; j < 7; j ++) {lettre [j] = LP [j];} break ; case « Q »: pour (int j = 0; j < 7; j ++) {lettre [j] = LQ [j];} break ; case « R »: pour (int j = 0; j < 7; j ++) {lettre [j] = LR [j];} break ; de l’affaire ": pour (int j = 0; j < 7; j ++) {lettre [j] = LS [j];} break ; affaire ' t ': pour (int j = 0; j < 7; j ++) {lettre [j] = LT [j];} break ; affaire « U »: pour (int j = 0; j < 7; j ++) {lettre [j] = LU [j];} break ; par défaut : pour (int j = 0; j < 7; j ++) {lettre [j] = def [j];} break ;
} }
void showDigit2 (int place, char s) {getPattern(s) ; digitalWrite(place,1) ; digitalWrite(a,letter[0]) ; digitalWrite(b,letter[1]) ; digitalWrite(c,letter[2]) ; digitalWrite(d,letter[3]) ; digitalWrite(e,letter[4]) ; digitalWrite(f,letter[5]) ; digitalWrite(g,letter[6]) ; delay(4) ; digitalWrite(place,0);} void showDigit (int place, char s) {getPattern(s) ; digitalWrite(place,1) ; digitalWrite(a,letter[0]) ; digitalWrite(b,letter[1]) ; digitalWrite (c , letter[2]) ; digitalWrite(d,letter[3]) ; digitalWrite(e,letter[4]) ; digitalWrite(f,letter[5]) ; digitalWrite(g,letter[6]) ;
Delay(4) ; digitalWrite(place,0) ; }