Вот скетч
Код: Выделить всё
int val = 0; //состояние кнопки
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(7, INPUT);
}
void loop()
{
val = digitalRead(7);
if (val == LOW) //горят и тухнут по три
{
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
delay(500);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
delay(1000);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
delay(500);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
delay(1000);
}
else //загораются и тухнут по одному
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
}
delay(2000);
}