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 Actions
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-10-01 20:58:40
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* code will be ina java script and code will allow */
- /* us to auto answer question right and skip through */
- /* videos this code is going to be the same as edgy */
- /* pro */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <EasyButton.h> //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*****/
- // Create instances of EasyButton for each button
- EasyButton button1(bottom_PushButton_PIN_D2); // Initialize button1 with pin D2
- EasyButton button2(bottom_PushButton_PIN_D3); // Initialize button2 with pin D3
- // Function prototypes for button press events
- void onButton1Pressed();
- void onButton2Pressed();
- void setup(void)
- {
- // Initialize serial communication for debugging
- Serial.begin(115200);
- // Print a message to the serial monitor
- Serial.println();
- Serial.println(">>> EasyButton example <<<");
- // Initialize the buttons
- button1.begin();
- button2.begin();
- // Set up the button press event handlers
- button1.onPressed(onButton1Pressed);
- button2.onPressed(onButton2Pressed);
- }
- void loop(void)
- {
- // Read the state of the buttons
- button1.read();
- button2.read();
- }
- // Function to be called when button1 is pressed
- void onButton1Pressed() {
- Serial.println("Button1 pressed");
- // Add code here to auto answer questions or perform actions
- // Example: autoAnswerQuestion();
- }
- // Function to be called when button2 is pressed
- void onButton2Pressed() {
- Serial.println("Button2 pressed");
- // Add code here to skip through videos or perform actions
- // Example: skipVideo();
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement