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 Monitor
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-02-13 10:07:47
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Bluetoot connection */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <EasyButton.h> // Library for button handling
- /****** FUNCTION PROTOTYPES *****/
- void setup();
- void loop();
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t buttonPin = 4; // Pin connected to the push button
- /****** DEFINITION OF LIBRARY CLASS INSTANCES*****/
- EasyButton myButton(buttonPin); // Button object instance
- void setup()
- {
- // put your setup code here, to run once:
- pinMode(buttonPin, INPUT_PULLUP); // Set the push button pin as input with internal pull-up resistor
- // Initialize the EasyButton object
- myButton.begin();
- }
- void loop()
- {
- // put your main code here, to run repeatedly:
- // Read the button state
- myButton.read();
- // check if the button has been pressed
- if (myButton.wasPressed())
- {
- // Action to be performed when the button is pressed
- Serial.println("Button has been pressed");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement