Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* 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: Debounced Button - Source Code compiled for: Arduino Opta WiFi - Source Code created on: 2025-10-05 15:05:13 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Detect a debounced push-button event on A0 using */ /* EasyButton; the input uses INPUT_PULLUP, so a */ /* pressed state is LOW and should trigger the system */ /* logic. Integrate flash over the air. */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ /****** DEFINITION OF LIBRARIES *****/ #include
// https://github.com/evert-arias/EasyButton #include
// https://github.com/pleasedontcode/POTA /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void buttonPressedOTA(); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t button_PushButton_PIN_A0 = A0; /****** DEFINITION OF LIBRARIES CLASS INSTANCES******/ EasyButton button(button_PushButton_PIN_A0); POTA ota; /* Callback invoked when the button is pressed. Triggers a POTA OTA check/perform. */ void buttonPressedOTA() { Serial.println("A0 button pressed - attempting OTA"); // Attempt OTA update using POTA POTAError err = ota.checkAndPerformOTA(); if (err == POTAError::NO_UPDATE_AVAILABLE) { Serial.println("OTA: No update available"); } else if (err != POTAError::SUCCESS) { Serial.print("OTA error: "); Serial.println(ota.errorToString(err)); } else { Serial.println("OTA update started or completed"); } } void setup(void) { Serial.begin(115200); Serial.println(); Serial.println("POTA OTA on A0 button (debounced) example"); // Configure the input with internal pull-up to match system requirement pinMode(button_PushButton_PIN_A0, INPUT_PULLUP); // Initialize the button debouncer button.begin(); // Attach press event button.onPressed(buttonPressedOTA); } void loop(void) { // Update button state (debouncing handled by library) button.read(); // You may add small delay here if desired } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)