byte butt=0; int red=13; int yellow=12; int green=11; int rd=8; int w=6; int i=0;
void setup() {
pinMode(red, OUTPUT); pinMode(yellow, OUTPUT); pinMode(green, OUTPUT); pinMode(w, OUTPUT); pinMode(rd, OUTPUT); pinMode(2, INPUT);
}
void loop() {
butt=digitalRead(2);
if (butt==0)
{
delay(1000);
digitalWrite(green,LOW); digitalWrite(yellow,HIGH);
delay(1000);
digitalWrite(yellow,LOW); digitalWrite(red,HIGH);
delay(1000);
digitalWrite(rd,LOW); digitalWrite(w,HIGH);
delay(2000);
boop();
delay(2000);
}
else if (butt==1)
{
digitalWrite(green,HIGH); digitalWrite(rd,HIGH); digitalWrite(w,LOW); digitalWrite(yellow,LOW); digitalWrite(red,LOW);
}
}
void boop()
{
digitalWrite(rd,HIGH); delay(250); digitalWrite(rd,LOW); delay(250);
digitalWrite(rd,HIGH); delay(250); digitalWrite(rd,LOW); delay(250);
digitalWrite(rd,HIGH); delay(250); digitalWrite(rd,LOW); delay(250);
digitalWrite(rd,HIGH); delay(250); digitalWrite(rd,LOW); delay(250);
digitalWrite(rd,HIGH); delay(250); digitalWrite(rd,LOW); delay(250);
digitalWrite(rd,HIGH);
digitalWrite(w,LOW);
}
Comments