Advertisement
pleasedontcode

"Pin Setup" rev_188

Jan 14th, 2024
64
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: "Pin Setup"
  13.     - Source Code compiled for: Arduino Nano ESP32
  14.     - Source Code created on: 2024-01-14 12:37:59
  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.  
  34. /***** DEFINITION OF ANALOG INPUT PINS *****/
  35. const uint8_t anhighimped_PIN_A0 = A0;
  36. const uint8_t anpullup_PIN_A1 = A1;
  37. const uint8_t anpulldown_PIN_A2 = A2;
  38.  
  39. /****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
  40. EasyButton button(button_PushButton_PIN_D2);
  41.  
  42. void onPressed()
  43. {
  44.     // Implement the action to be performed when the button is pressed
  45. }
  46.  
  47. void setup(void)
  48. {
  49.     // put your setup code here, to run once:
  50.     pinMode(button_PushButton_PIN_D2, INPUT_PULLUP);
  51.     pinMode(anhighimped_PIN_A0, INPUT);
  52.     pinMode(anpullup_PIN_A1, INPUT_PULLUP);
  53.     pinMode(anpulldown_PIN_A2, INPUT_PULLDOWN);
  54.    
  55.     // Set the onPress callback function
  56.     button.onPressed(onPressed);
  57. }
  58.  
  59. void loop(void)
  60. {
  61.     // put your main code here, to run repeatedly:
  62.     button.read(); // Read the state of the button
  63.    
  64.     // Your code for system requirements can be implemented here, if required.
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement