Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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 LCD"
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-06-07 04:08:28
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* lcd display i2c 20x4 button pin11 UP LOW menu up */
- /* button pin10 UP LOW menu enter button pin12UP LOW */
- /* menu down Temperatur submenu MaxTemp */
- /* subsubmenu MinTeamp subsubmenu Durchfluss(Flow) */
- /* submenu MaxFlow subsubmenu MinFlow subsubmenu */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <EasyButton.h> //https://github.com/evert-arias/EasyButton
- #include <LiquidCrystal_I2C.h> //https://github.com/marcoschwartz/LiquidCrystal_I2C
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t UP_BUTTON_PushButton_PIN_D11 = 11;
- const uint8_t DOWN_BUTTON_PushButton_PIN_D12 = 12;
- const uint8_t ENTER_BUTTON_PushButton_PIN_D10 = 10;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- EasyButton buttonUp(UP_BUTTON_PushButton_PIN_D11); // Initialize EasyButton for UP button
- EasyButton buttonDown(DOWN_BUTTON_PushButton_PIN_D12); // Initialize EasyButton for DOWN button
- EasyButton buttonEnter(ENTER_BUTTON_PushButton_PIN_D10); // Initialize EasyButton for ENTER button
- LiquidCrystal_I2C lcd(0x27, 20, 4); // Initialize LiquidCrystal_I2C with I2C address 0x27 and a 20x4 LCD
- /****** CALLBACK FUNCTIONS FOR BUTTONS *****/
- void onButtonUpPressed() {
- Serial.println("UP button pressed");
- }
- void onButtonDownPressed() {
- Serial.println("DOWN button pressed");
- }
- void onButtonEnterPressed() {
- Serial.println("ENTER button pressed");
- }
- void setup(void) {
- // put your setup code here, to run once:
- Serial.begin(115200);
- // Initialize buttons
- buttonUp.begin();
- buttonDown.begin();
- buttonEnter.begin();
- // Attach callback functions
- buttonUp.onPressed(onButtonUpPressed);
- buttonDown.onPressed(onButtonDownPressed);
- buttonEnter.onPressed(onButtonEnterPressed);
- pinMode(UP_BUTTON_PushButton_PIN_D11, INPUT_PULLUP);
- pinMode(DOWN_BUTTON_PushButton_PIN_D12, INPUT_PULLUP);
- pinMode(ENTER_BUTTON_PushButton_PIN_D10, INPUT_PULLUP);
- // Initialize the LCD
- lcd.init();
- lcd.backlight();
- lcd.setCursor(3, 0);
- lcd.print("Hello, world!");
- lcd.setCursor(2, 1);
- lcd.print("Ywrobot Arduino!");
- lcd.setCursor(0, 2);
- lcd.print("Arduino LCM IIC 2004");
- lcd.setCursor(2, 3);
- lcd.print("Power By Ec-yuan!");
- }
- void loop(void) {
- // put your main code here, to run repeatedly:
- buttonUp.read();
- buttonDown.read();
- buttonEnter.read();
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement