Project 2: Digital Input

Faiza Kamilah
2 min readFeb 13, 2022

Last week was our very first time meeting ESP32, LED, jumper, and stuffs. This week, we’ll try another challenging project with … as per usual, we need to get ready first.

There are some newcomers! Including star of the week, the push button. Here’s how we need to arrange them according to the schema. Keep in mind that the 330 Ohm resistor need to be parallel with our LED and the 10K Ohm resistor be with one of the push button’s leg.

The D4 GPIO4 Pin is connected to the push button, and the D5 GPIO5 Pin is connected to the positive lead of the LED.

After all of our hardwares are in place and secured, we coded the program we’re using in this program. It should be looking like this:

We can see that our code for today’s project consist of cost int buttonPin this is to declare input for our push button. The int buttonState = 0 is telling us the status of our button. The rest’s mainly similar to last week’s code.After trying to upload it, if everything goes well, we should be seeing the LED turns on every time we push the pushbutton.

https://youtu.be/lRRVgs90xfk

Get Creative!

There are many components that we can play with in this project. This time, i’m going to try it with more LEDs. Of course i’m trying this by arranging them according to the schema. Because we’re adding LED, that means we’re going to add more resistor.

After all of our hardwares are in place and secured, we coded the program we’re using in this program. It should be looking like this:

After trying to upload it, if everything goes well, we should be seeing LEDs turning on every time we push the pushbutton.

https://youtu.be/xaIG8gpcv3c

--

--