Shop OBEX P1 Docs P2 Docs Learn Events
generating variable-based filename for Memory Stick Datalogger? — Parallax Forums

generating variable-based filename for Memory Stick Datalogger?

Pascal PPascal P Posts: 26
edited 2009-10-19 05:35 in BASIC Stamp
Hello,

I am using the Memory Stick Datalogger (#27937) to save data collected with a BS2p into a .csv file.
The whole process is working fine except that I have to "hardcode" the filename in my program using the command SEROUT TX\CTS, DtlgBaud, [noparse][[/noparse]"OPW filename.csv", CR], meaning the filename is always the same.

I was hoping the filename could be based on a variable, for instance the date and time at which the file is generated so that each filename be unique, e.g. a file saved on Oct 18 at 1400 could·be called F1018_14.csv while another·saved·on Oct 19 at 0800 be called F1019_08.csv That way, there is no risk of overwritting previous dataset.

I read the FTDI documentation, tried Extended·and Shortened commands, as well as reviewed the GPS Datalogger project recently posted. But·the filename always seem to be fixed so I'm starting to thing this cannot be done. But before I give up, I thought I would ask around.
So, has anyone ever tried·to·generate a filename·based on some variable for a file to be saved using the Memory Stick Datalogger?

Cheers,
Pascal

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-19 05:35
    The easiest thing to do is to use a number as part of the file name. If the number is called "serial", you'd do:

    SEROUT TX\CTS, DtlgBaud, [noparse][[/noparse]"OPWfile",DEC4 Serial,".csv",CR]

    If Serial is 5, this would create a file called "file0005.csv".
Sign In or Register to comment.