# LED + Push Button

This example uses 2 LEDs and a switch to make an ON/OFF door lock. When the RED LED is ON then the door lock is closed. When you press the BUTTON, door will open and the RED LED will be off and the GREEN LED will be ON.

## Parts List

You will need the following parts:

* **1x** arduino uno
* **1x** arduino uno USB Cable
* **1x** Breadboard
* **5x** Jumper Wire
* **1x** Red LED
* **1x** Green LED
* **1x** Push button switch
* **3x** Resistors

## Wiring it up <a href="#wiring-it-up" id="wiring-it-up"></a>

![](https://gblobscdn.gitbook.com/assets%2F-LskXJjPT2bXMIodrtZq%2F-M6P4jbJShCfxTkf9fUe%2F-M6PGee2UzMUQaU1Zzhm%2Farduino%20-%20push%20button.png?alt=media\&token=6560d5d4-3c82-4078-b5bc-0189c83b02c0)

Ensure that the LEDs are the right way around, with the longer positive leads (anodes) to the left.

## Block Coding <a href="#block-coding" id="block-coding"></a>

![](https://gblobscdn.gitbook.com/assets%2F-LskXJjPT2bXMIodrtZq%2F-M6M10kB3c5xeZ-_KHRp%2F-M6M1KjiCGa6nTusYnSj%2Farduino%20-%20push%20button%20code.png?alt=media\&token=2fbb324d-a51c-496c-b197-da811971fa02)

{% embed url="<https://ide.mblock.cc/#/?cloudProjectId=218454>" %}


---

# 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://learn.arduinosa.co.za/blocking-coding-lessons/beginner-lessons/led-+-push-button.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.
