/********* 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 Detection
- Source Code NOT compiled for: Arduino Uno
- Source Code created on: 2024-09-25 13:10:00
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* Kullanıcı etkileşimleri için dijital pin D2'de */
/* INPUT_PULLUP yapılandırmasıyla güvenilir giriş */
/* işleme sağlayarak EasyButton kitaplığını */
/* kullanarak bir düğme arabirimi uygulayın. */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include //https://github.com/evert-arias/EasyButton
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t v_PushButton_PIN_D2 = 2;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
// Initialize the EasyButton object for the push button on pin D2
EasyButton button1(v_PushButton_PIN_D2, 35, true, true); // Debounce time 35ms, pullup enabled, active low
/****** FUNCTION DEFINITIONS *****/
void setup(void)
{
// Start the serial communication for debugging
Serial.begin(115200);
// Print a welcome message to the serial monitor
Serial.println();
Serial.println(">>> EasyButton example <<<");
// Initialize the button
button1.begin();
// Set the button press event handler
button1.onPressed([]() {
Serial.println("Button pressed");
});
}
void loop(void)
{
// Continuously read the button state
button1.read();
}
/* END CODE */