I’m having problems writing a code to save images from a camera and sensor data from when it took the picture in the void loop. This will be in a balloonSat payload and I need to know when the pictures start saving based on the pressure, temp, time, and altitude. In the code I’ve made so far the problem seems to start when it has to open the .txt file for saving. Without that code the pictures save just fine, but if that code is left in (which was pulled from another sketch where it saved the data just fine), even if that code is after saving an image, it will not save the picture at all. It just creates a 0 KB unreadable image file on the SD card and can’t open the .txt file. Does anyone have any ideas?
Which Arduino are you running the code on? Each File instance needs 512 bytes of SRAM. Since you have two of them, that is half the memory available on the 328-based Arduinos. With all the string literals being copied (unnecessarily) to SRAM, it is likely that you are running out of memory.
I'm using an adafruit Pro Trinket 5V
Raxius: I'm using an adafruit Pro Trinket 5V
That's why we designed Pro Trinket, with 18 GPIO, 2 extra analog inputs, 28K of flash, and 2K of RAM.
Are you running out of memory?