Componenti:
- 5 cavetti MM
- 3 LED: verde, giallo e rosso
- 1 cicalino
- 3 resistenze di 220 Ω
Il codice:
void setup()
{
pinMode(3, OUTPUT); // cicalino
pinMode(11, OUTPUT); // verde
pinMode(10, OUTPUT); // giallo
pinMode(9, OUTPUT); // rosso
}
void loop()
{
digitalWrite(11, HIGH);
delay(2500);
for (int i = 0; i < 5; i++) {
digitalWrite(3, HIGH);
digitalWrite(10, HIGH);
delay(500);
digitalWrite(10, LOW);
digitalWrite(3, LOW);
delay(500);
}
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(1000);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(4000);
digitalWrite(9, LOW);
}