Advertisement
pleasedontcode

Button Configuration rev_187

Jan 14th, 2024
71
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 Configuration
  13.     - Source Code compiled for: Arduino Nano ESP32
  14.     - Source Code created on: 2024-01-14 12:31:23
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* do nothing */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Arduino.h>
  25. #include <EasyButton.h>
  26.  
  27. /****** FUNCTION PROTOTYPES *****/
  28. void setup(void);
  29. void loop(void);
  30.  
  31. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  32. const uint8_t button_PushButton_PIN_D2 = 2;
  33. const uint8_t digitalinput_PIN_D3 = 3;
  34. const uint8_t diginputwithpullup_PIN_D4 = 4;
  35. const uint8_t diginputwithpulldown_PIN_D5 = 5;
  36.  
  37. /****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
  38. EasyButton button_PushButton(button_PushButton_PIN_D2);
  39.  
  40. void setup(void)
  41. {
  42.     // initialize digital input pins
  43.     pinMode(digitalinput_PIN_D3, INPUT);
  44.     pinMode(diginputwithpullup_PIN_D4, INPUT_PULLUP);
  45.     pinMode(diginputwithpulldown_PIN_D5, INPUT_PULLDOWN);
  46.  
  47.     // begin button instance
  48.     button_PushButton.begin();
  49. }
  50.  
  51. void loop(void)
  52. {
  53.     // read button state
  54.     button_PushButton.read();
  55.  
  56.     /****** SYSTEM REQUIREMENTS *****/
  57.     /****** SYSTEM REQUIREMENT 1 *****/
  58.     // do nothing
  59.     /****** END SYSTEM REQUIREMENTS *****/
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement