1int l1 = 2;
2int l2 = 3;
3int l3 = 4;
4int l4 = 5;
5int l5 = 6;
6int l6 = 7;
7int l7 = 8;
8int b = 10;
9long ran;
10
11void setup()
12{
13 pinMode(l1, OUTPUT);
14 pinMode(l2, OUTPUT);
15 pinMode(l3, OUTPUT);
16 pinMode(l4, OUTPUT);
17 pinMode(l5, OUTPUT);
18 pinMode(l6, OUTPUT);
19 pinMode(l7, OUTPUT);
20 pinMode(b, INPUT_PULLUP);
21 Serial.begin(9600);
22 Serial.println("----------------------------------------------");
23 Serial.println("---------------De numerique 2.0---------------");
24 Serial.println("----------------------------------------------");
25}
26
27void loop()
28{
29 if (digitalRead(b) == LOW)
30 {
31 ran = random(1,7);
32 if(ran == 1) {
33 digitalWrite(l4, HIGH);
34 Serial.print("1, ");
35 delay(3000);
36 }
37 if(ran == 2) {
38 digitalWrite(l3, HIGH);
39 digitalWrite(l5, HIGH);
40 Serial.print("2, ");
41 delay(3000);
42 }
43 if(ran == 3) {
44 digitalWrite(l3, HIGH);
45 digitalWrite(l4, HIGH);
46 digitalWrite(l5, HIGH);
47 Serial.print("3, ");
48 delay(3000);
49 }
50 if(ran == 4) {
51 digitalWrite(l1, HIGH);
52 digitalWrite(l3, HIGH);
53 digitalWrite(l5, HIGH);
54 digitalWrite(l7, HIGH);
55 Serial.print("4, ");
56 delay(3000);
57 }
58 if(ran == 5) {
59 digitalWrite(l4, HIGH);
60 digitalWrite(l1, HIGH);
61 digitalWrite(l3, HIGH);
62 digitalWrite(l5, HIGH);
63 digitalWrite(l7, HIGH);
64 Serial.print("5, ");
65 delay(3000);
66 }
67 if(ran == 6) {
68 digitalWrite(l1, HIGH);
69 digitalWrite(l2, HIGH);
70 digitalWrite(l3, HIGH);
71 digitalWrite(l5, HIGH);
72 digitalWrite(l6, HIGH);
73 digitalWrite(l7, HIGH);
74 Serial.print("6, ");
75 delay(3000);
76 }
77 }
78 digitalWrite(l1, LOW);
79 digitalWrite(l2, LOW);
80 digitalWrite(l3, LOW);
81 digitalWrite(l4, LOW);
82 digitalWrite(l5, LOW);
83 digitalWrite(l6, LOW);
84 digitalWrite(l7, LOW);
85}
86