CCCPaste

Button Manager rev_01

/********* 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 Manager
	- Source Code NOT compiled for: ESP32 DevKit V1
	- Source Code created on: 2024-10-15 10:12:10

********* Pleasedontcode.com **********/

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* Hfyunyhsywbwybdhd */
/****** END SYSTEM REQUIREMENTS *****/

/****** DEFINITION OF LIBRARIES *****/
#include   // https://github.com/evert-arias/EasyButton

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);

/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t Mydot_PushButton_PIN_D4 = 4;
const uint8_t Mydot_PushButton_PIN_D13 = 13;

/****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
// Create instances of EasyButton for each button
EasyButton button1(Mydot_PushButton_PIN_D4);  // Button connected to pin D4
EasyButton button2(Mydot_PushButton_PIN_D13); // Button connected to pin D13

void setup(void)
{
    // Initialize Serial for debugging purposes
    Serial.begin(115200);
    Serial.println();
    Serial.println(">>> EasyButton example with multiple buttons <<<");

    // Initialize the buttons
    button1.begin();
    button2.begin();

    // Set up callbacks for button presses
    button1.onPressed([]() {
        Serial.println("Button on D4 pressed");
    });
    button2.onPressed([]() {
        Serial.println("Button on D13 pressed");
    });
}

void loop(void)
{
    // Continuously read the status of the buttons
    button1.read();
    button2.read();
}

/* END CODE */