Módulo semáforo
Características
Módulo semáforo
- Tensão de funcionamento: 3.3-5v
- Tipo de interface: digital
- PH2.54 Socket
REF: KS0310
Este Módulo semáforo integra três LEDs de cores diferentes (verde, amarelo e vermelho), para a simulação de um semáforo. Para além de ser muito conveniente em exercícios interativos com o Arduino, este módulo facilita a ligações com a placa Arduino, sendo apenas necessário fazer quatro ligações.
3,10€ IVA INCL.
Módulo semáforo
int redled =5; // initialize digital pin 5. int yellowled =4; // initialize digital pin 4. int greenled =3; // initialize digital pin 3. void setup() { pinMode(redled, OUTPUT);// set the pin with red LED as “output” pinMode(yellowled, OUTPUT); // set the pin with yellow LED as “output” pinMode(greenled, OUTPUT); // set the pin with green LED as “output” } void loop() { digitalWrite(greenled, HIGH);//// turn on green LED delay(5000);// wait 5 seconds digitalWrite(greenled, LOW); // turn off green LED for(int i=0;i<3;i++)// blinks for 3 times { delay(500);// wait 0.5 seconds digitalWrite(yellowled, HIGH);// turn on yellow LED delay(500);// wait 0.5 seconds digitalWrite(yellowled, LOW);// turn off yellow LED } delay(500);// wait 0.5 seconds digitalWrite(redled, HIGH);// turn on red LED delay(5000);// wait 5 seconds digitalWrite(redled, LOW);// turn off red LED }