/********* 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: Tech_arduinov1 - Source Code compiled for: Arduino Uno - Source Code created on: 2023-10-14 21:41:22 - Source Code generated by: AlexWind ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include #include /****** SYSTEM REQUIREMENT 1 *****/ /* turn on the light when you click the button */ /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t BUTTON_PIN = 2; const uint8_t LED_PIN = LED_BUILTIN; // Initialize the button object EasyButton button(BUTTON_PIN); void setup(void) { // put your setup code here, to run once: pinMode(LED_PIN, OUTPUT); // Define the callback function to turn on the light when the button is pressed button.onPressed([]() { digitalWrite(LED_PIN, HIGH); }); // Begin the button object button.begin(); } void loop(void) { // put your main code here, to run repeatedly: // Update the button state button.read(); // Check if the button is pressed if (button.isPressed()) { // Call the callback function to turn on the light digitalWrite(LED_PIN, HIGH); } // Check if the button is released if (button.isReleased()) { // Call the callback function to turn off the light digitalWrite(LED_PIN, LOW); } }