Advertisement
pleasedontcode

i rev_01

Sep 25th, 2023
110
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: i
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-09-25 10:17:15
  15.     - Source Code generated by: baqir
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <EasyButton.h>
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23.     /* Object avoiding plus edge avoiding car */
  24. /****** SYSTEM REQUIREMENT 2 *****/
  25.     /* Object avoiding plus edge avoiding robot */
  26.  
  27. /****** FUNCTION PROTOTYPES *****/
  28. void setup(void);
  29. void loop(void);
  30.  
  31. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  32. const uint8_t i_PushButton_PIN_D2 = 2;
  33.  
  34. EasyButton button(i_PushButton_PIN_D2); // Instantiate EasyButton object
  35.  
  36. void setup(void)
  37. {
  38.     // put your setup code here, to run once:
  39.     pinMode(i_PushButton_PIN_D2, INPUT_PULLUP);
  40.     button.begin(); // Initialize the button object
  41.  
  42. }
  43.  
  44. void loop(void)
  45. {
  46.     // put your main code here, to run repeatedly:
  47.     button.update(); // Update the button state
  48.  
  49.     if (button.isPressed()) // Check if the button is pressed
  50.     {
  51.         // Perform action when the button is pressed
  52.     }
  53.  
  54.     if (button.wasPressed()) // Check if the button was pressed
  55.     {
  56.         // Perform action when the button was pressed
  57.     }
  58.  
  59.     if (button.pressedFor(1000)) // Check if the button has been pressed for at least 1 second
  60.     {
  61.         // Perform action when the button has been pressed for 1 second
  62.     }
  63.  
  64.     if (button.releasedFor(500)) // Check if the button has been released for at least 500 milliseconds
  65.     {
  66.         // Perform action when the button has been released for 500 milliseconds
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement