Configuration blocks are best placed in an
on start block although using the
data logger block later to stop logging is recommended.
data logger set separator allows you to choose tab, comma, or semicolon - if you have a program which will look through the log file, choosing the separator may help in a program opening the data file correctly. Using comma allows for opening in a program that understands comma separated values (CSV).
set data logger sampling interval helps to ensure data is not sampled less than the interval you specify. If you have a pause during reading greater than the sample period, you'll assure you will not exceed the sample period.
data logger to console allows the logged data to be sent to the MakeCode console for viewing, handy for seeing what is being written to the file. NOTE: The graphing in the console only shows a value called "data" which does not appear to be any of the values - possibly a bug.
data logger block to turn logging off and on. You should turn the
logging on before writing to the log file with the Data blocks. NOTE: Use
data logger off to close the logging file for use. If you do not, your system may hang trying to open the log file as the operating system still believes the file is in use.
The default values output is a time code based on when the board you are using was last reset.
You can add one or more data values to log. Each value should have a
data logger add block where the
"x" is a text tag for what the data is (which goes in the column heading) and the number is a value you want written.
Once all the data values for a particular timestamp has been written with the
data logger add block(s), use the
data logger add row block to complete that particular set of readings and prepares the data file for a new set of data at a new timestamp. In a spreadsheet, this would be similar to going to a new row.