Description
Consider a user that would like to be able to log the accelerometer data in x,y,z with time, and then read that out over serial
The following program attempts to do that:
https://makecode.microbit.org/_auL9Jk0fz9Es
(the checkAndErase function is there to let you hold down the A button while rebooting to erase the output file).
To use this, press button A to start logging, then button B to stop logging. Then press A+B to send the file over serial.
This is fine if you just care about one thing, but if you want to export something more CSV-like then the current data capture options don't work very well.
The 'time,x,y,z' comes into the 'data' buffer and the rest of the data ends up in the graph, but the export doesn't include anything except the first column
You can workaround this by adding, say, some arbitrary text to the start of the line like a comma.
But this is a bit of a kludge
(The simulator actually behaves differently, I'm about to file an issue for the difference, but the simulator puts text direct in the data buffer not on the graph).
If we remove the timestamps that I have added but keep the comma (IE so there is chance of duplicate data) then there's a further problem of grouping and being unable to graph that easily by copy/pasting the data out:
Some suggestions that would resolve this for me
1: We should special-case comma separated values and plot them all, and allow them to be all exported via the CSV feature
2. We should also put complex data into the buffer.
3. We should allow a simple 'raw' data export from that box. A simple .txt file without the 'repeated data joining' would be great.
I still think presenting 'file' objects to download (even drag into the filesystem) from the 'read to serial' block would be ideal too.