# Semáforo

Nesse exemplo vamos fazer um semáforo de uma via.

## Materiais

* 1 Placa Franzininho;
* 1 Protoboard;
* 1 LED vermelho
* 1 LED amarelo
* 1 LED verde
* 3 Resistores 330 R
* 5 Jumpers macho/fêmea
* 3 Jumpers macho/macho

## Circuito

Faça a seguinte ligação no protoboard:

![](/files/-MIVtBWryEbYdBd5xgHp)

## Sketch

```cpp
/*
  Franzininho
  Exemplo: Semáforo

Nesse exemplo vamos fazer um semáforo de uma via.

*/


int vermelho = 2; //LED Vermelho
int amarelo = 1; //LED Amarelo
int verde = 0; //LED Verde

void setup() {
 pinMode(vermelho,OUTPUT); //define LED vermelho como Saída
 pinMode(verde,OUTPUT);   //define LED verde como Saída
 pinMode(amarelo,OUTPUT); //define LED Amarelo como Saída
}

void loop() {

  //fase 1
  digitalWrite(vermelho,HIGH);
  digitalWrite(amarelo,LOW);
  digitalWrite(verde,LOW);

  delay(5000);

  //fase 2
  digitalWrite(vermelho,LOW);
  digitalWrite(amarelo,HIGH);
  digitalWrite(verde,LOW);

 delay(1000);

 //fase 3
  digitalWrite(vermelho,LOW);
  digitalWrite(amarelo,LOW);
  digitalWrite(verde,HIGH);

  delay(5000);

}
```

## Video

{% embed url="<https://www.youtube.com/watch?v=jdFRHqfmzik>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://franzininho.gitbook.io/franzininho-docs/exemplos/semaforo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
