/********* 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 Hello - Source Code compiled for: Arduino Uno - Source Code created on: 2024-01-24 20:30:24 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* if button is pressed so print hello on serial */ /* monitor */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include /****** FUNCTION PROTOTYPES *****/ void setup(); void loop(); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t buttonPin = 2; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ EasyButton button(buttonPin); // Instantiate the EasyButton object with the button pin void setup() { pinMode(buttonPin, INPUT_PULLUP); // Set the button pin as INPUT_PULLUP button.begin(); // Initialize the button object // Define the callback function for when the button is pressed button.onPressed([]() { Serial.println("Hello"); }); // Start the serial communication Serial.begin(115200); Serial.println(); Serial.println(">>> EasyButton pressed example <<<"); } void loop() { button.read(); // Read the button state // Add your additional code here }