Close

Email ESP32 Cam code changes

A project log for The Ultimate Birdfeeder

There are now 4 devices involved with the birdfeeder. Latest is a temperature controlled Frisbee/birdbath.

nodemcu12ecanadanodemcu12ecanada 01/01/2022 at 16:120 Comments

The email ESP32 Cam was sending only a partial or no pic so also added a SPIFFS format statement in the setup to correct this. Sends photo every 1/2 hr if bright enough. Removes photo from SPIFFS after email sent.

Code added to example from : https://randomnerdtutorials.com/esp32-cam-send-photos-email/#comment-715842

bool formatted = SPIFFS.format(); //formats SPIFFS if corrupt and only partial picture

void loop() {

    if (digitalRead(2) == LOW) digitalWrite(33, LOW); // TURN on LED if dark
    
   if (digitalRead(2) == HIGH) {
     digitalWrite(33, HIGH);
     capturePhotoSaveSpiffs();
     sendPhoto();
     SPIFFS.remove("FILE_PHOTO"); // remove photo after email sent
    delay (1800000);
   }
    
}

Discussions