Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: i
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-09-25 10:17:15
- - Source Code generated by: baqir
- ********* Pleasedontcode.com **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <EasyButton.h>
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Object avoiding plus edge avoiding car */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* Object avoiding plus edge avoiding robot */
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t i_PushButton_PIN_D2 = 2;
- EasyButton button(i_PushButton_PIN_D2); // Instantiate EasyButton object
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(i_PushButton_PIN_D2, INPUT_PULLUP);
- button.begin(); // Initialize the button object
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- button.update(); // Update the button state
- if (button.isPressed()) // Check if the button is pressed
- {
- // Perform action when the button is pressed
- }
- if (button.wasPressed()) // Check if the button was pressed
- {
- // Perform action when the button was pressed
- }
- if (button.pressedFor(1000)) // Check if the button has been pressed for at least 1 second
- {
- // Perform action when the button has been pressed for 1 second
- }
- if (button.releasedFor(500)) // Check if the button has been released for at least 500 milliseconds
- {
- // Perform action when the button has been released for 500 milliseconds
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement