/********* 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 Configuration - Source Code compiled for: ESP32 DevKit V1 - Source Code created on: 2024-01-14 16:26:02 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* if button is pressed so set out to 128. */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include #include /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* if button is pressed so set out to 128. */ const uint8_t out_PIN_D25 = 25; /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t butt_PushButton_PIN_D4 = 4; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ EasyButton button(butt_PushButton_PIN_D4); void setup(void) { pinMode(butt_PushButton_PIN_D4, INPUT_PULLUP); pinMode(out_PIN_D25, OUTPUT); Serial.begin(115200); Serial.println(">>> EasyButton Example <<<"); button.begin(); } void loop(void) { button.read(); if (button.isPressed()) { analogWrite(out_PIN_D25, 128); } else { analogWrite(out_PIN_D25, 0); } }