int bluePin = 10;
int greenPin = 9;
int redPin = 11;
int relay = 31;
int inPin = 41; // number of the input pin
int status = false;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(inPin, INPUT_PULLUP);
pinMode(relay, OUTPUT);
}
void loop()
{
digitalWrite(greenPin,HIGH);//Startup Green
delay(250);
digitalWrite(greenPin,LOW);
delay(250);
digitalWrite(bluePin,HIGH);//Startup Blue
delay(250);
digitalWrite(bluePin,LOW);
delay(250);
digitalWrite(redPin,HIGH);//Startup Red
delay(250);
digitalWrite(redPin,LOW);
delay(250);
digitalWrite(greenPin,HIGH);//Final Startup
digitalWrite(bluePin,HIGH);
digitalWrite(redPin,HIGH);
delay(5000);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,LOW);
digitalWrite(redPin,LOW);
delay(1000);
digitalWrite(bluePin,HIGH); //on and sit blue until switch
if (digitalRead(inPin) ==true){
while(digitalRead(inPin) ==true);
for (int j=1; j<=10; j=j+1){
digitalWrite(bluePin,HIGH);
delay(500);
digitalWrite(bluePin,LOW);
delay(500);
}
while(digitalRead(inPin) ==true);
for (int j=1; j<=10; j=j+1){
digitalWrite(redPin,HIGH);
delay(1000);
digitalWrite(redPin,LOW);
delay(500);
digitalWrite(greenPin,HIGH);
delay(1000);
digitalWrite(greenPin,LOW);
delay(1);
digitalWrite(relay,HIGH);
delay(2000);
digitalWrite(relay,LOW);
delay(2000);
}
digitalWrite(bluePin,HIGH);
digitalWrite(greenPin,HIGH);
digitalWrite(redPin,HIGH);
delay(10000);
}
}
Comments