Recording Data with Lists in VexCode Pro

Thank you for any attention to this post. I am attempting to record an encoder in a list. I have written a program that prints the data to the screen and then prints the list. The two sets of numbers are different. I was hoping someone could point out what I was doing wrong.


The screen then prints this:
two different lists, since I am a new user I cannot upload a second image. I will try to upload it as the first comment. Also, I am trying to figure out how to embed code.

Thanks again.

This is what the list looks like.

myTestData is an array of uint8_t, so values will be limited to the range 0 to 255. Make it int32_t.


I am in awe.

Thank you.

When I try to Brain.SDcard.savefile then it throws an error that myTestData is not a uint8_t , is there a way around this?

btw, I am sure it is obvious, but the base of this program was from jpearman.

cast the array to uint8_t *.

  Brain.SDcard.savefile("test.txt", reinterpret_cast<uint8_t *>(testData), lengthToSave );

yea, we should have probably have made that function take a void *.
remember that the length you pass is in bytes, so if you need to save 100 uint32_t values, it would be 400.


Thanks again.

I also found one of your previous posts. I ended up using some of that code and this also accomplished my goal.


I will try and understand your solution, it appears more advanced. Happy Holidays.

This is the whole code:


Edited program to make it more condense.

And in the next post the resultant file


(uint8_t *)buffer

is the C version of

reinterpret_cast<uint8_t *>(buffer)

which is the C++ equivalent

strlen isn’t going to work properly with an array of binary data, it will look for first occurrence of a byte with a value of 0. If you want to save the whole array, use sizeof(myTestData)
(ok, I see you switched to saving a text string, so strlen will work ok)