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 Detection
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-10-13 16:20:12
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Implementar una interfaz de usuario para el */
- /* proyecto "wampankith" que aproveche la biblioteca */
- /* EasyButton para un manejo perfecto de los botones, */
- /* garantizando una entrada confiable desde el botón */
- /* pulsador en el pin D2. */
- /****** 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 BUTTON_PIN_D2 = 2; // Define the pin for the push button
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
- // Initialize the EasyButton object for the push button
- EasyButton button(BUTTON_PIN_D2);
- /****** FUNCTION DEFINITIONS *****/
- void setup(void)
- {
- // Start serial communication for debugging
- Serial.begin(115200);
- // Print a message to the Serial Monitor
- Serial.println();
- Serial.println(">>> EasyButton example <<<");
- // Initialize the button
- button.begin();
- // Set the button press event
- button.onPressed([]() {
- Serial.println("Button pressed"); // Action to perform when button is pressed
- });
- }
- void loop(void)
- {
- // Continuously read the button state
- button.read();
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement