I found a sketch that lets you send and email attachments from an SD card and am trying to merge it with another sketch that lets you take a picture when triggered by sound or PIR. (from amazon 20 bucks).
Well, it will do either it seems, but merging them only works once in a while. I use EEPROM to write a save a number, so if, when it wakes up it sees 0 it takes a picture and saves a 1, then wdt resets itself. On reset it will send me the picture. Using serial monitor I notice most of the time I get SD card error. However if I release the SD card and then just put it back in it usually works the next time. Not practical however.
Has anyone had better luck with this? Seems to be SD vs SD_MMC. once you run one you can't run the other.
I use EEPROM to write a save a number, so if, when it wakes up it sees 0 it takes a picture and saves a 1, then wdt resets itself. On reset it will send me the picture. Using serial monitor I notice most of the time I get SD card error. However if I release the SD card and then just put it back in it usually works the next time. Not practical however.
Sorry, but this quite a stupid way to organize your program. You store the state of your sketch in EEPROM (once a minute, the EEPROM will die after 70-80 days or so) and then reboot the ESP. Is there a reason to use such a horrible way to run through 4 stages every minute? I mean other than wearing out the hardware relatively fast.
You're using a lot of ESP internals (like ets_printf()). Do you know what you do there or do you just think that's cool?
that was for testing. when complete it would read thingspeak and only operate then. the esp stuff was in the sample that came with it. I have no idea what those actually do.
as far as the hardware wearing out, I was under the impression you had at least 100000 cycles or write. Also, I could set it to skip to the next byte after say 50000.
as far as the hardware wearing out, I was under the impression you had at least 100000 cycles or write. Also, I could set it to skip to the next byte after say 50000.
Yes, 100000 write cycles and 100000 minutes are about 70 days.
I'm not sure how EEPROMs are organized but probably the have blocks as flash memory and write complete blocks. So using the next byte won't change anything. And how would you know that you had 50000 cycles?
Using EEPROM was a last ditch effort. It works every time too, if you release and reinsert the sd card between actions.
Why are you using the restart feature to create something that is almost identical to a simple loop? Have you tried to eliminate the EEPROM writing/reading and remove the esp_restart() line?
Easy use another byte to track the number of weeks the thing had been in service. so the last minute of the last hour of the week you update then delay a minute to let that minute rollover so you don't update again.
but this EEPROM stuff was only to see if there were pointers/registers etc., stepping on each other by running SD and SD_MMC concurrently. I was not necessarily going to run it that way, and even if I did the breaks between modules would have been much longer because they would have been triggered thru a separate file updated manually.
Have you tried to convert all of say SD_MMC to SD instead of trying to use both?
You don't appear to say what Arduino you are using, but if you have SD and SD_MMC with each having a 512 byte buffer, coupled with you using the String class, and a buffer in use with the camera memory usage is likely to be very high and could easily result in unexpected problems.
What ESP32 board are you using? Is the SD card slot on the ESP32 board or is it seperate in which case which one?
The SD_MMC library uses a different mechanism to access the SD card than the SD library, so it is highly unlikely that you can access the SD card using both, you will need to opt for one or the other depending on yor hardware I believe. This probably explains why you have to reinsert the SD card - though I wouldn't have expected both libraries to work.
yes I did read that! I got to where is said it didn't work by putting it to sleep, so I incorporated the EEPROM switch function which did not work well either. but I will read the rest of it now. thanks.