Code:
char e = 12;
char d = 11;
char c = 10;
char dp = 9;
char b = 8;
char a = 7;
char f = 6;
char g = 5;
int ut = 150;
char ug = 100;
char gianni = 2;
char francesco = 0;
void setup() {
randomSeed(analogRead(A0));
pinMode(e, OUTPUT);
pinMode(d, OUTPUT);
pinMode(c, OUTPUT);
pinMode(dp, OUTPUT);
pinMode(b, OUTPUT);
pinMode(a, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
digitalWrite(e, HIGH);
digitalWrite(d, HIGH);
digitalWrite(c, HIGH);
digitalWrite(b, HIGH);
digitalWrite(a, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(dp, HIGH);
delay (1000);
digitalWrite(e, LOW);
digitalWrite(d, LOW);
digitalWrite(c, LOW);
digitalWrite(b, LOW);
digitalWrite(a, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(dp, LOW);
delay (1000);
ceck();
delay (1000);
}
void loop() {
francesco = random (1,7);
delay (500);
switch(francesco){
case 1:
cic (255, 0, 0, 0, 0, 255, 0, 0);
break;
case 2:
cic (255, 255, 0, 255, 255, 0, 255, 0);
break;
case 3:
cic (0, 255, 255, 255, 255, 0, 255, 0);
break;
case 4:
cic (0, 0, 255, 255, 0, 255, 255, 0);
break;
case 5:
cic (0, 255, 255, 0, 255, 255, 255, 0);
break;
case 6:
cic (00, 00, 00, 255, 00, 00, 00, 255);
break;
}
}
void cic(int un_c, int du_c, int tr_c, int qu_c, int ci_c, int si_c, int st_c, int ot_c){
digitalWrite(e, un_c);
digitalWrite(d, du_c);
digitalWrite(c, tr_c);
digitalWrite(b, qu_c);
digitalWrite(a, ci_c);
digitalWrite(f, si_c);
digitalWrite(g, st_c);
digitalWrite(dp, ot_c);
}
void ceck(){
cic (0, 0, 0, 0, 0, 255, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 255, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 255, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 255, 0);
delay(ug);
cic (255, 0, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (255, 0, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 255, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 255, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 255, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 255, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 255, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 255, 0);
delay(ug);
cic (255, 0, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 255, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
}
char d = 11;
char c = 10;
char dp = 9;
char b = 8;
char a = 7;
char f = 6;
char g = 5;
int ut = 150;
char ug = 100;
char gianni = 2;
char francesco = 0;
void setup() {
randomSeed(analogRead(A0));
pinMode(e, OUTPUT);
pinMode(d, OUTPUT);
pinMode(c, OUTPUT);
pinMode(dp, OUTPUT);
pinMode(b, OUTPUT);
pinMode(a, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
digitalWrite(e, HIGH);
digitalWrite(d, HIGH);
digitalWrite(c, HIGH);
digitalWrite(b, HIGH);
digitalWrite(a, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(dp, HIGH);
delay (1000);
digitalWrite(e, LOW);
digitalWrite(d, LOW);
digitalWrite(c, LOW);
digitalWrite(b, LOW);
digitalWrite(a, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(dp, LOW);
delay (1000);
ceck();
delay (1000);
}
void loop() {
francesco = random (1,7);
delay (500);
switch(francesco){
case 1:
cic (255, 0, 0, 0, 0, 255, 0, 0);
break;
case 2:
cic (255, 255, 0, 255, 255, 0, 255, 0);
break;
case 3:
cic (0, 255, 255, 255, 255, 0, 255, 0);
break;
case 4:
cic (0, 0, 255, 255, 0, 255, 255, 0);
break;
case 5:
cic (0, 255, 255, 0, 255, 255, 255, 0);
break;
case 6:
cic (00, 00, 00, 255, 00, 00, 00, 255);
break;
}
}
void cic(int un_c, int du_c, int tr_c, int qu_c, int ci_c, int si_c, int st_c, int ot_c){
digitalWrite(e, un_c);
digitalWrite(d, du_c);
digitalWrite(c, tr_c);
digitalWrite(b, qu_c);
digitalWrite(a, ci_c);
digitalWrite(f, si_c);
digitalWrite(g, st_c);
digitalWrite(dp, ot_c);
}
void ceck(){
cic (0, 0, 0, 0, 0, 255, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 255, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 255, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 255, 0);
delay(ug);
cic (255, 0, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (255, 0, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 255, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 255, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 255, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 255, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 255, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 255, 0);
delay(ug);
cic (255, 0, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 255, 0, 0, 0, 0, 0, 0);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
delay(ut);
cic (0, 0, 0, 0, 0, 0, 0, 255);
delay(ug);
cic (0, 0, 0, 0, 0, 0, 0, 0);
}
// C.N.
Nessun commento:
Posta un commento