Arduino Pushbutton Menu System with I2C LCD Display Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to our Channel today we're diving into an exciting Arduino project we'll be creating a menu system controlled by a push button and displaying the menu on an i2c LCD let's get [Music] started here's what you'll need for this project an Arduino Uno a push button a 16x2 i2c LCD display a breadboard and some jumper wires a 10K Ohm resistor first let's connect everything here's the circuit diagram connect the push button to digital pin 2 on the Arduino one side of the push button goes to 5V and the other side connects to ground through a 10K Ohm resistor the same side that goes through the resistor also connects to digital pin 2 next connect the i2c LCD the SDA pin connects to A4 and the pin connects to A5 on the Arduino connect VCC to 5V and gnd D to gnd here's how I assembled this circuit [Music] now let's dive into the code we'll be using using the Liquid Crystal i2c library to control the LCD to install it you need to download it first I'll be posting the link to the library in the description after downloading open your Arduino IDE go to sketch include Library add zip Library locate the downloaded zip file and click open to install with the library installed it's time to write some code let's break down the code first we include the necessary libraries y.h for i2c communication and liquid Crystal i2c H for controlling the LCD we Define the LCD object with the specific pins connected to the i2c module we also Define the button pin and create variables to track the button State and the current menu in the setup function we initialize the LCD with LCD do begin 162 to set it up as a 16x2 display we also turn on the backlight with LCD dob backlight and set the button pin as an input the loop function reads the button state with digital read X if the button is pressed we increment the edore num variable to cycle through the menu options here's an important part of the code when the button is pressed digital redex will return a value of one this condition checks if the button is pressed if true we increment the ledore num variable by one this variable keeps track of the current menu mode every button press advances leadore Nome to the next mode depending on the value of ledore num we clear the LCD and display the corresponding mode when leadore n reaches three it resets to zero to start the cycle over the delay 300 function ensures a 300 MC pause between readings to debounce the button and avoid multiple triggers from a single press now let's upload the code to the Arduino and see it in action now let's see how we can use this menu system in a practical application imagine where creating a simple lighting control system with different modes in mode one the LED is off in mode two the LED is on in mode 3 the LED blinks let's update our code to include these functionalities in this updated code we added an LED connected to pin 13 in mode one the LED is off in mode two the LED is on in mode 3 the LED blinks five times before resetting back to mode one let's see it in action when you press the button the menu options cycle through and the LED responds according to the selected [Music] mode this demonstration shows just one example of how you can use a simple menu system for practical applications feel free to customize and expand it further to fit your specific projects thanks for watching if you enjoyed this video give it a thumbs up and sub subscribe for more Arduino projects don't forget to hit the Bell icon to get notified of our latest uploads happy building
Info
Channel: Arduino Intro
Views: 314
Rating: undefined out of 5
Keywords: #Arduino, #Pushbutton, #MenuSystem, #I2CLCD, #ArduinoTutorial, #BeginnerProjects, #DIYElectronics, #Microcontroller, #ElectronicsProject, #CodingForBeginners, #ArduinoProjects, #TechTutorials
Id: _Rv8S7v6k_g
Channel Id: undefined
Length: 5min 6sec (306 seconds)
Published: Sun Jul 14 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.