# Leitura de Tecla

## Materiais

* Placa Franzininho;
* Protoboard;
* LED 3mm;
* Resistor 220;
* 1 Resistor de 1K;&#x20;
* 1 Botão;
* Jumpers macho/fêmea;

## Circuito

No protoboard você deve inserir o LED, resistores e o botão, conforme a imagem abaixo:

![](/files/-ML4x813bBWHvOOPQDYJ)

## Sketch

```cpp
/*
  Franzininho
  Exemplo: Leitura de Tecla - Pull Down

  Esse exemplo exibe como ler uma tecla com resistor de pull down e acionar um led quando ela for pressionada

*/

const int LED = 1; //pino para o LED
const int BOTAO = 2; //pino para o botão

int val = 0; // val será utilizado para armazenar o estado do pino

void setup(){
  pinMode(LED,OUTPUT); //o LED é uma saída
  pinMode(BOTAO,INPUT); //o BOTAO é uma entrada
}

void loop (){
val = digitalRead(BOTAO); // lê e armazena o valor de entrada
digitalWrite(LED, val); //aciona LED conforme valor lido do botão

}
```

## Video

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


---

# 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/leitura-de-tecla.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.
