/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: Arduino Menu
- Source Code compiled for: Arduino Uno
- Source Code created on: 2024-01-24 05:01:36
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* when push button press show menu on lcd */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
#include
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t BUTTON_PIN = 2;
/***** DEFINITION OF LCD VARIABLES *****/
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address and dimensions
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
EasyButton button(BUTTON_PIN); // Instantiate the EasyButton object
void setup(void)
{
// Initialize the LCD
lcd.begin(16, 2);
// Set up the LCD text
lcd.print("Press the button");
// Set up the button pin
pinMode(BUTTON_PIN, INPUT_PULLUP);
// Initialize the button object
button.begin();
}
void loop(void)
{
// Read the button state
button.read();
// Check if the button is pressed
if (button.isPressed())
{
// Clear the LCD display
lcd.clear();
// Show the menu on the LCD
lcd.print("Menu options...");
lcd.setCursor(0, 1);
lcd.print("Option 1");
// Add more menu options as needed
}
}