I have a CO2 sensor and Adafruit GPS module, and it has to log data using an SD card Shield that is compatible with arduino uno board but I'm having issues getting it to work. When I have it connected to the computer I can get it to display the GPS NMEA sentences and CO2 voltage and PPM reading but it won't record to the SD card consistently after it's plugged in to an external power.
This is the code that I run. The problem is when it logs data to the SD card. It manages to print a lot when it's plugged into the computer and the serial monitor shows a lot of data points, but in the SD card it only logs a maximum of 3 or less.
I attached the code below.