pugliasos newlogoDEF

Orario della segreteria: tutti i martedì, dalle ore 17 alle 19, su appuntamento.

Semaforo unidirezionale con cicalino html b36403400678a280

 

 

 

 

 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);
}

Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline