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: Button Control
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-07 03:25:53
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* turn on light */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <EasyButton.h>
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* turn on light */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t motor_PushButton_PIN_D2 = 2;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- EasyButton motor_PushButton(motor_PushButton_PIN_D2);
- void setup(void)
- {
- // put your setup code here, to run once:
- Serial.begin(115200);
- motor_PushButton.begin();
- pinMode(LED_BUILTIN, OUTPUT); // Set LED_BUILTIN as an output pin
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- motor_PushButton.read();
- // Check if the motor push button is pressed
- if (motor_PushButton.isPressed()) {
- // Turn on the light
- digitalWrite(LED_BUILTIN, HIGH);
- } else {
- // Turn off the light
- digitalWrite(LED_BUILTIN, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement