Advertisement
pleasedontcode

Button Logic rev_01

Dec 17th, 2023
80
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 Logic
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-12-17 17:41:39
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* configurar a rede para identificar erros */
  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 df_PushButton_PIN_D2 = 2;
  33.  
  34. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  35. EasyButton button(df_PushButton_PIN_D2);
  36.  
  37. /****** SYSTEM REQUIREMENTS *****/
  38. /****** SYSTEM REQUIREMENT 1 *****/
  39. /* configure the network for error detection */
  40. void configureNetworkErrorDetection()
  41. {
  42.   // Add code here to configure the network error detection
  43. }
  44.  
  45. void setup(void)
  46. {
  47.   // put your setup code here, to run once:
  48.  
  49.   pinMode(df_PushButton_PIN_D2, INPUT_PULLUP);
  50.  
  51.   // Initialize the button.
  52.   button.begin();
  53.  
  54.   // Configure the network for error detection
  55.   configureNetworkErrorDetection();
  56. }
  57.  
  58. void loop(void)
  59. {
  60.   // put your main code here, to run repeatedly:
  61.  
  62.   // Update the button state
  63.   button.read();
  64.  
  65.   // Check if the button was pressed
  66.   if (button.isPressed())
  67.   {
  68.     // Button pressed logic here
  69.   }
  70. }
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement