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 Logger
- - Source Code NOT compiled for: XIAO ESP32S3
- - Source Code created on: 2025-10-05 21:10:18
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* read button */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <EasyButton.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void buttonPressed();
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t button_PushButton_PIN_D0 = 0;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/// Button instance attached to D0
- EasyButton button(button_PushButton_PIN_D0);
- void buttonPressed()
- {
- Serial.println("Button pressed");
- }
- void setup(void)
- {
- // put your setup code here, to run once:
- Serial.begin(115200);
- Serial.println();
- Serial.println(">>> POTATest.ino - Button read example <<<");
- // Configure the input pin with internal pull-up
- pinMode(button_PushButton_PIN_D0, INPUT_PULLUP);
- // Initialize the EasyButton instance
- button.begin();
- // Register the pressed callback
- button.onPressed(buttonPressed);
- }
- void loop(void)
- {
- // Read the status of the button
- button.read();
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment