/********* 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: "Button Messages"
- Source Code NOT compiled for: Arduino Uno
- Source Code created on: 2024-06-07 03:53:06
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* lcd display i2c 20x4 button pin11 INPUT_PULLUP */
/* LOW menu up button pin10 INPUT_PULLUP LOW menu */
/* enter button pin12 INPUT_PULLUP LOW menu down */
/* startmenu test1 test2 submenu test1 lol1 lol2 */
/* sub menu test2 ha1 ha2 */
/****** SYSTEM REQUIREMENT 2 *****/
/* lcd display i2c 20x4 button pin11 UPLOW menu up */
/* button pin10 UP LOW menu enter button pin12UP LOW */
/* menu down Temperatur->MaxTemp->code */
/* ->MinTeamp->code Durchfluss(Flow)->MaxFlow->code */
/* ->MinTeamp->code */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include //https://github.com/evert-arias/EasyButton
#include
#include
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void onUpButtonPressed();
void onDownButtonPressed();
void onEnterButtonPressed();
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t UP_BUTTON_PIN = 11;
const uint8_t DOWN_BUTTON_PIN = 12;
const uint8_t ENTER_BUTTON_PIN = 10;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
EasyButton upButton(UP_BUTTON_PIN, 35, true, false); // Initialize EasyButton instance for UP button
EasyButton downButton(DOWN_BUTTON_PIN, 35, true, false); // Initialize EasyButton instance for DOWN button
EasyButton enterButton(ENTER_BUTTON_PIN, 35, true, false); // Initialize EasyButton instance for ENTER button
LiquidCrystal_I2C lcd(0x27, 20, 4); // Set the LCD I2C address to 0x27 for a 20 chars and 4 line display
void setup(void)
{
// put your setup code here, to run once:
Serial.begin(115200);
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("System Initializing");
Serial.println();
Serial.println(">>> EasyButton multiple buttons example <<<");
upButton.begin();
downButton.begin();
enterButton.begin();
upButton.onPressed(onUpButtonPressed);
downButton.onPressed(onDownButtonPressed);
enterButton.onPressed(onEnterButtonPressed);
}
void loop(void)
{
// put your main code here, to run repeatedly:
upButton.read();
downButton.read();
enterButton.read();
}
void onUpButtonPressed() {
Serial.println("Up button pressed");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Up button pressed");
}
void onDownButtonPressed() {
Serial.println("Down button pressed");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Down button pressed");
}
void onEnterButtonPressed() {
Serial.println("Enter button pressed");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Enter button pressed");
}
/* END CODE */