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: EasyButton Events
- - Source Code NOT compiled for: Arduino Mega
- - Source Code created on: 2025-08-25 09:48:42
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* simplify the given code */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <EasyButton.h> //https://github.com/evert-arias/EasyButton
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void powerOnPressed();
- void analysePressed();
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t powerOn_PushButton_PIN_D2 = 2;
- const uint8_t analyse_PushButton_PIN_D3 = 3;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
- EasyButton powerOnBtn(powerOn_PushButton_PIN_D2);
- EasyButton analyseBtn(analyse_PushButton_PIN_D3);
- void setup(void)
- {
- // put your setup code here, to run once:
- Serial.begin(9600);
- // Initialize pins with internal pull-ups
- pinMode(powerOn_PushButton_PIN_D2, INPUT_PULLUP);
- pinMode(analyse_PushButton_PIN_D3, INPUT_PULLUP);
- // Initialize EasyButton instances
- powerOnBtn.begin();
- analyseBtn.begin();
- // Attach callbacks
- powerOnBtn.onPressed(powerOnPressed);
- analyseBtn.onPressed(analysePressed);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- powerOnBtn.read();
- analyseBtn.read();
- }
- void powerOnPressed()
- {
- Serial.println("Power On Button pressed");
- }
- void analysePressed()
- {
- Serial.println("Analyse Button pressed");
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment