You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the wonderful work here, However I observed multiple false trigger in the code, so i attached a de-bounce code to make it work smoothly.
void loop() {
static bool lastButtonState = LOW; // Track the previous button state
static unsigned long lastDebounceTime = 0;
const unsigned long debounceDelay = 50; // 50ms debounce time
int currentButtonState = digitalRead(triggerButton);
// Check for state change and debounce
if (currentButtonState != lastButtonState) {
lastDebounceTime = millis(); // Reset debounce timer
}
if ((millis() - lastDebounceTime) > debounceDelay) {
// If the button state is stable and pressed
if (currentButtonState == HIGH) { // Button pressed (HIGH with pull-down)
int status = sendPhoto();
if (status == -1) {
displayText("Image Capture Failed");
} else if (status == -2) {
displayText("Server Connection Failed");
}
delay(500); // Additional delay for user feedback (optional)
}
}
lastButtonState = currentButtonState; // Update the button state
}
The text was updated successfully, but these errors were encountered:
Thank you for the wonderful work here, However I observed multiple false trigger in the code, so i attached a de-bounce code to make it work smoothly.
The text was updated successfully, but these errors were encountered: