# Tramas Elétricas
### Blink + semáforo
```arduino=
// dando um "nome" para as portas
// blink no pino 13
int vermelho = 12;
int amarelo = 11;
int verde = 10;
void setup() {
// indicando para o arduíno quais portas vamos usar
pinMode(vermelho, OUTPUT);
pinMode(amarelo, OUTPUT);
pinMode(verde, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// vamos começar do amarelo. Estranho não?
// você vai entender no próximo exercício!
digitalWrite(vermelho, LOW);
digitalWrite(amarelo, HIGH);
digitalWrite(verde, LOW);
// esperamos 2s com o sinal no amarelo
// fazendo em paralelo o blink do 13
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
// apagamos o amarelo e ligamos o vermelho
digitalWrite(amarelo, LOW);
digitalWrite(vermelho, HIGH);
// Não precisa desse pois o verde já estava apagado
// digitalWrite(verde, LOW);
// esperamos 5s com o sinal fechado
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
// para finalizar, apagamos o vermelho e ligamos o verde
digitalWrite(verde, HIGH);
// não precisa desse pois o amarelo já estava apagado
// digitalWrite(amarelo, LOW);
digitalWrite(vermelho, LOW);
// esperamos 5s com o sinal aberto
delay(1000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
}
```