multiple log files with datalogger shield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
andywatson
 
Posts: 28
Joined: Wed Feb 16, 2011 12:40 am

multiple log files with datalogger shield

Post by andywatson »

I have an Arduino Pro board along with the Adafruit datalogger shield. So far I've only been logging data from one sensor, but I can successfully write the time stamp and sensor value to the file at 5 minute intervals. But now I need to measure 6 sensors and some of them will be sampled every minute and some every 5 minutes. So instead of writing all of the data to different columns in the same log file, I'd like to have 6 different log files open, one for each sensor. Is that possible?

User avatar
adafruit_support_bill
 
Posts: 88138
Joined: Sat Feb 07, 2009 10:11 am

Re: multiple log files with datalogger shield

Post by adafruit_support_bill »

You can open & close the files as needed as is done here: http://forums.adafruit.com/viewtopic.ph ... le#p105627

andywatson
 
Posts: 28
Joined: Wed Feb 16, 2011 12:40 am

Re: multiple log files with datalogger shield

Post by andywatson »

I saw that page earlier, but it wasn't clear to me if I have to open and close each file one at a time, or can you have multiple files open simultaneously and then choose which file you want to write to based on which sensor data comes in?

User avatar
adafruit_support_bill
 
Posts: 88138
Joined: Sat Feb 07, 2009 10:11 am

Re: multiple log files with datalogger shield

Post by adafruit_support_bill »

Yea, that wasn't the best example. SDFat does allow multiple files to be open. You would create a separate file object for each open file.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: multiple log files with datalogger shield

Post by adafruit »

the new SD library that we have in github (you installed it already) does support multiple files! the 'default' SD library does. please try it, it should 'just work' to have multiple File objects

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”