1
2
3int bluePin = 10;
4int greenPin = 9;
5int redPin = 11;
6int relay = 31;
7int inPin = 41;
8int status = false;
9void setup()
10{
11 pinMode(redPin, OUTPUT);
12 pinMode(greenPin, OUTPUT);
13 pinMode(bluePin, OUTPUT);
14pinMode(inPin, INPUT_PULLUP);
15pinMode(relay, OUTPUT);
16}
17void loop()
18
19{
20
21 digitalWrite(greenPin,HIGH);
22 delay(250);
23 digitalWrite(greenPin,LOW);
24 delay(250);
25
26 digitalWrite(bluePin,HIGH);
27 delay(250);
28 digitalWrite(bluePin,LOW);
29 delay(250);
30
31 digitalWrite(redPin,HIGH);
32 delay(250);
33 digitalWrite(redPin,LOW);
34 delay(250);
35
36 digitalWrite(greenPin,HIGH);
37 digitalWrite(bluePin,HIGH);
38 digitalWrite(redPin,HIGH);
39 delay(5000);
40 digitalWrite(greenPin,LOW);
41 digitalWrite(bluePin,LOW);
42 digitalWrite(redPin,LOW);
43 delay(1000);
44
45 digitalWrite(bluePin,HIGH);
46
47if (digitalRead(inPin) ==true){
48while(digitalRead(inPin) ==true);
49for (int j=1; j<=10; j=j+1){
50 digitalWrite(bluePin,HIGH);
51 delay(500);
52 digitalWrite(bluePin,LOW);
53 delay(500);
54}
55while(digitalRead(inPin) ==true);
56for (int j=1; j<=10; j=j+1){
57 digitalWrite(redPin,HIGH);
58 delay(1000);
59 digitalWrite(redPin,LOW);
60 delay(500);
61 digitalWrite(greenPin,HIGH);
62 delay(1000);
63 digitalWrite(greenPin,LOW);
64 delay(1);
65 digitalWrite(relay,HIGH);
66 delay(2000);
67 digitalWrite(relay,LOW);
68 delay(2000);
69}
70
71 digitalWrite(bluePin,HIGH);
72 digitalWrite(greenPin,HIGH);
73 digitalWrite(redPin,HIGH);
74 delay(10000);
75}
76
77}
78
79
80