Advertisement
pleasedontcode

EasyButton Rotation rev_01

Apr 25th, 2024
104
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 Rotation
  13.     - Source Code NOT compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-04-26 04:43:16
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* rotate left or right after press push button */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <EasyButton.h>  // https://github.com/evert-arias/EasyButton
  25.  
  26. /****** FUNCTION PROTOTYPES *****/
  27. void setup();
  28. void loop();
  29.  
  30. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  31. const uint8_t Sensor_PushButton_PIN_D4 = 4;
  32.  
  33. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  34. EasyButton button(Sensor_PushButton_PIN_D4); // Instantiate EasyButton object for the push button
  35.  
  36. void setup()
  37. {
  38.   // Setup the push button pin
  39.   pinMode(Sensor_PushButton_PIN_D4, INPUT_PULLUP);
  40.  
  41.   // Initialize the EasyButton object
  42.   button.begin();
  43. }
  44.  
  45. void loop()
  46. {
  47.   // Read the state of the button
  48.   button.read();
  49.  
  50.   // Check if the button is pressed
  51.   if (button.isPressed())
  52.   {
  53.     // Perform action to rotate left or right after pressing the push button
  54.     // Add your code here for rotating left or right
  55.   }
  56. }
  57.  
  58. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement