Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

esp32 Tutorial 2:ESP32 + LED + 4 Buttons = Easy OR Logic!

Автор: KIMI Maker

Загружено: 2025-03-29

Просмотров: 596

Описание:

In this tutorial, we will create a simple project using the ESP32 microcontroller to control an LED using four buttons. The goal is to demonstrate how to implement OR logic in hardware using the ESP32, which means the LED will turn on when any one of the buttons is pressed. This is a great example for beginners who are learning how digital input and output work on the ESP32.

We start with connecting the hardware components. You will need one LED and four push buttons. The LED should be connected to a digital pin on the ESP32, for example, GPIO two. You also need a resistor in series with the LED to limit the current, typically around two hundred twenty ohms. The cathode or the shorter leg of the LED goes to ground, while the anode connects through the resistor to the chosen GPIO pin.

Each push button will also be connected to a GPIO pin on the ESP32. In our case, we can use GPIO thirteen, twelve, fourteen, and twenty-seven. One side of each button connects to the respective GPIO pin, and the other side connects to ground. Since the buttons are connected to ground, we will use the internal pull-up resistors provided by the ESP32. These pull-up resistors ensure that when the button is not pressed, the input reads a high voltage level. When the button is pressed, it connects the pin directly to ground, and the input reads as low.

In software, we configure the LED pin as an output and all four button pins as input with internal pull-up resistors enabled. This setup allows the ESP32 to detect when each button is pressed without needing external components like pull-up resistors.

The main logic is simple. Inside the loop, we check the state of all four buttons. If any one of the buttons is detected as pressed, meaning the input reads low, we treat it as a trigger to turn the LED on. If none of the buttons are pressed, the LED remains off. This is the essence of OR logic. As long as at least one condition is true, in this case at least one button is pressed, the output condition is activated, and the LED turns on.

This type of logic is very common in real-world applications. For example, imagine a security system where any one of several sensors can trigger an alarm. Or think about a control panel where multiple emergency stop buttons can shut down a machine. In all these cases, OR logic ensures that any one input is enough to create the desired response.

This project also helps you understand how to manage multiple digital inputs in a loop, and how to build decision-making logic based on real-time input states. It is also a foundation for more advanced logic systems where you can combine AND and OR operations or even use more complex combinations with timers, counters, or flags.

If you are planning to expand this project, here are a few ideas. You could add a buzzer that activates along with the LED. Or instead of just turning the LED on and off, you could make it blink or change brightness using pulse width modulation. You could also connect the ESP32 to WiFi and send a notification to your phone whenever a button is pressed. Another fun extension is to display the button states on an OLED screen or a TFT display.

In conclusion, controlling an LED with multiple buttons using OR logic is a simple but powerful project to help you understand how digital inputs and outputs work with the ESP32. It lays the groundwork for more advanced DIY projects and gives you hands-on experience with hardware programming. Keep experimenting and combining components to bring your creative ideas to life. This is just the beginning of what you can do with ESP32 and your maker journey.

esp32 Tutorial 2:ESP32 + LED + 4 Buttons = Easy OR Logic!

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

array(10) { [0]=> object(stdClass)#4204 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "uWrN1RCQrgA" ["related_video_title"]=> string(38) "How To Wire It! Buttons & Switches" ["posted_time"]=> string(19) "9 лет назад" ["channelName"]=> string(12) "ItKindaWorks" } [1]=> object(stdClass)#4177 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "W-Tl0_EdlI8" ["related_video_title"]=> string(77) "STM32 Multiple Buttons ADC Read Through One Pin With Software Button Debounce" ["posted_time"]=> string(21) "3 года назад" ["channelName"]=> string(18) "Useful Electronics" } [2]=> object(stdClass)#4202 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "yi29dbPnu28" ["related_video_title"]=> string(39) "Arduino 101- Crash Course w/ Mark Rober" ["posted_time"]=> string(19) "1 год назад" ["channelName"]=> string(10) "CrunchLabs" } [3]=> object(stdClass)#4209 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "L2J_eNgjxio" ["related_video_title"]=> string(40) "Making oddly satisfying LED magnet tiles" ["posted_time"]=> string(27) "8 месяцев назад" ["channelName"]=> string(7) "bitluni" } [4]=> object(stdClass)#4188 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "Jav4HF5ttbQ" ["related_video_title"]=> string(80) "Цифровой драйвер энкодера для STM32 и ESP32 (Arduino)" ["posted_time"]=> string(22) "10 дней назад" ["channelName"]=> string(5) "ruMCA" } [5]=> object(stdClass)#4206 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "lWq5vur8xPQ" ["related_video_title"]=> string(76) "esp32 and push button led on off #electronics #diy #linefollowerrobot #esp32" ["posted_time"]=> string(27) "5 месяцев назад" ["channelName"]=> string(22) "electronics new sensor" } [6]=> object(stdClass)#4201 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "ZJKxyxf1C9k" ["related_video_title"]=> string(127) "Россия вступает в войну на Ближнем Востоке? / Жёсткое заявление МИД РФ" ["posted_time"]=> string(23) "6 часов назад" ["channelName"]=> string(10) "NEXTA Live" } [7]=> object(stdClass)#4211 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "Pc66yOsH1TE" ["related_video_title"]=> string(94) "Литий-Графеновый аккумулятор. Может за ним будущее?" ["posted_time"]=> string(19) "3 дня назад" ["channelName"]=> string(8) "Kit-Shop" } [8]=> object(stdClass)#4187 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "ChHNI8yt69g" ["related_video_title"]=> string(60) "Arduino Tutorial 34: Simplest Way to Use a Pushbutton Switch" ["posted_time"]=> string(19) "5 лет назад" ["channelName"]=> string(14) "Paul McWhorter" } [9]=> object(stdClass)#4205 (5) { ["video_id"]=> int(9999999) ["related_video_id"]=> string(11) "nkAlxzTuf2I" ["related_video_title"]=> string(86) "Декодер. Игра гения (2024, фильм) Decoded | Dram, Historical film" ["posted_time"]=> string(23) "1 месяц назад" ["channelName"]=> string(23) "Doctor Smile Azerbaijan" } }
How To Wire It! Buttons & Switches

How To Wire It! Buttons & Switches

STM32 Multiple Buttons ADC Read Through One Pin With Software Button Debounce

STM32 Multiple Buttons ADC Read Through One Pin With Software Button Debounce

Arduino 101- Crash Course w/ Mark Rober

Arduino 101- Crash Course w/ Mark Rober

Making oddly satisfying LED magnet tiles

Making oddly satisfying LED magnet tiles

Цифровой драйвер энкодера для STM32 и ESP32 (Arduino)

Цифровой драйвер энкодера для STM32 и ESP32 (Arduino)

esp32 and push button led on off #electronics #diy #linefollowerrobot #esp32

esp32 and push button led on off #electronics #diy #linefollowerrobot #esp32

Россия вступает в войну на Ближнем Востоке? / Жёсткое заявление МИД РФ

Россия вступает в войну на Ближнем Востоке? / Жёсткое заявление МИД РФ

Литий-Графеновый аккумулятор. Может за ним будущее?

Литий-Графеновый аккумулятор. Может за ним будущее?

Arduino Tutorial 34: Simplest Way to Use a Pushbutton Switch

Arduino Tutorial 34: Simplest Way to Use a Pushbutton Switch

Декодер. Игра гения (2024, фильм) Decoded | Dram, Historical film

Декодер. Игра гения (2024, фильм) Decoded | Dram, Historical film

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]