Advertisement
pleasedontcode

Tech_arduinov1 rev_26

Oct 14th, 2023
102
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: Tech_arduinov1
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-10-14 21:33:40
  15.     - Source Code generated by: AlexWind
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <EasyButton.h>
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23. const uint8_t Tech_inc_PushButton_PIN_D2 = 2; // Define the pin for the button
  24.  
  25. EasyButton button(Tech_inc_PushButton_PIN_D2); // Create an instance of the EasyButton library
  26.  
  27. void setup(void)
  28. {
  29.   pinMode(Tech_inc_PushButton_PIN_D2, INPUT_PULLUP); // Set the button pin as input with internal pull-up resistor
  30.  
  31.   button.begin(); // Initialize the button
  32.  
  33.   // Attach a callback function to the onPressed event
  34.   button.onPressed([]() {
  35.     // Turn on the light when the button is pressed
  36.     digitalWrite(LED_BUILTIN, HIGH);
  37.   });
  38. }
  39.  
  40. void loop(void)
  41. {
  42.   button.read(); // Update the button state
  43.  
  44.   // put your main code here, to run repeatedly:
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement