CCCPaste

EasyButton Handling 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: EasyButton Handling
	- Source Code NOT compiled for: Arduino Uno
	- Source Code created on: 2024-10-01 20:53:30

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

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* code is going answer questions automatically */
	/* though edgeunity  as well as skip through videos */
	/* which will be able to see through the menu and the */
	/* code has to run though tamper monkey */
/****** 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 bottom_PushButton_PIN_D2 = 2; // Pin for Button 1
const uint8_t bottom_PushButton_PIN_D3 = 3; // Pin for Button 2

/****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
// Instantiate EasyButton objects for each button using the defined pin numbers
EasyButton button1(bottom_PushButton_PIN_D2); // Button on pin D2
EasyButton button2(bottom_PushButton_PIN_D3); // Button on pin D3

// Function prototypes for button press handlers
void onButton1Pressed();
void onButton2Pressed();

void setup(void)
{
    // Initialize serial communication for debugging
    Serial.begin(115200);
    
    // Print a message to indicate setup is starting
    Serial.println();
    Serial.println(">>> EasyButton example <<<");

    // Initialize the button instances
    button1.begin();
    button2.begin();

    // Set up the button press event handlers
    button1.onPressed(onButton1Pressed);
    button2.onPressed(onButton2Pressed);
}

void loop(void)
{
    // Read the button states
    button1.read();
    button2.read();
}

// Function to handle button 1 press event
void onButton1Pressed() {
    Serial.println("Button 1 pressed");
    // Functionality to answer questions automatically
    // This could be a call to a function that interacts with EdgeUnity or TamperMonkey
}

// Function to handle button 2 press event
void onButton2Pressed() {
    Serial.println("Button 2 pressed");
    // Functionality to skip through videos or navigate menus
    // This could be a call to a function that interacts with EdgeUnity or TamperMonkey
}

/* END CODE */