Need help writing sensor data to SD card file

arduarn:
Ok, so now you are not closing the dataFile in printData() at all. That could be an issue since the SD library probably caches small writes until is feels it has enough to write out to the card; if you never close or sync/flush the file then the small writes may never be written out. In your case, you also keep reopening the already open file with FILE_WRITE, which may also cause issues.

So, if you are going to open the file at the beginning of the function, then you need to close it again at the end of the function.

Thank you Arduarn! It works great!!

Complete code attached.

Connects_to_Internet_and_has_data_1_13_19a.ino (8.34 KB)