pleasedontcode

EasyButton Press rev_16

Oct 5th, 2025
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: EasyButton Press
  13.     - Source Code compiled for: XIAO ESP32S3
  14.     - Source Code created on: 2025-10-05 21:11:55
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* read button */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23.  
  24.  
  25.  
  26. /* START CODE */
  27.  
  28. /****** DEFINITION OF LIBRARIES *****/
  29. #include <EasyButton.h>
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34. void buttonPressed();
  35.  
  36. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  37. const uint8_t button_PushButton_PIN_D0        = 0;
  38.  
  39. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/// Button instance attached to D0
  40. EasyButton button(button_PushButton_PIN_D0);
  41.  
  42. void buttonPressed()
  43. {
  44.   Serial.println("Button pressed");
  45. }
  46.  
  47. void setup(void)
  48. {
  49.   // put your setup code here, to run once:
  50.  
  51.   Serial.begin(115200);
  52.   Serial.println();
  53.   Serial.println(">>> POTATest.ino - Button read example <<<");
  54.  
  55.   // Configure the input pin with internal pull-up
  56.   pinMode(button_PushButton_PIN_D0, INPUT_PULLUP);
  57.  
  58.   // Initialize the EasyButton instance
  59.   button.begin();
  60.  
  61.   // Register the pressed callback
  62.   button.onPressed(buttonPressed);
  63. }
  64.  
  65. void loop(void)
  66. {
  67.   // Read the status of the button
  68.   button.read();
  69. }
  70.  
  71. /* END CODE */
  72.  
Advertisement
Add Comment
Please, Sign In to add comment