Advertisement
pleasedontcode

Button Activation rev_01

Mar 7th, 2024
61
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: Button Activation
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2024-03-07 16:37:19
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* push button to start code running */
  21. /****** SYSTEM REQUIREMENT 2 *****/
  22.     /* push button to start code running */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <EasyButton.h>
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31.  
  32. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  33. const uint8_t START_PUSHBUTTON_PIN = 2;
  34.  
  35. /****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
  36. EasyButton startButton(START_PUSHBUTTON_PIN);
  37.  
  38. /****** SYSTEM REQUIREMENTS *****/
  39. /****** SYSTEM REQUIREMENT 1 *****/
  40.   /* push button to start code running */
  41. /****** SYSTEM REQUIREMENT 2 *****/
  42.   /* push button to start code running */
  43. /****** END SYSTEM REQUIREMENTS *****/
  44.  
  45. void setup(void)
  46. {
  47.   // put your setup code here, to run once:
  48.   Serial.begin(115200);
  49.   startButton.begin();
  50.  
  51.   // Add additional setup code here if needed
  52. }
  53.  
  54. void loop(void)
  55. {
  56.   // put your main code here, to run repeatedly:
  57.   startButton.read();
  58.  
  59.   // Check if the start button is pressed
  60.   if (startButton.isPressed())
  61.   {
  62.     // Your code logic for system requirement 1 goes here
  63.   }
  64.  
  65.   // Add additional logic for other system requirements here if needed
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement