SD Card Printing

Hello again, I was just wondering if anyone could help us with our problem. So, our robot has a button that logs all motor rotations as a command into the SDcard, the only problem is that if you set it to loop, one motors rotations reset their line. So, we cannot get a constant automatic autonomous. Can anybody look into this and help? If you can tell what I’m even saying. :joy:

If we spin motor1 to 100 deg it logs this command in the SDcard.

Motor1.spinFor(directionType::fwd, 100, vex::rotationUnits::deg);

but if we spin another 120 degrees it overwrites that 100 inside that same first line

Motor1.spinFor(directionType::fwd, 220, vex::rotationUnits::deg);

I am trying to see if we can just set the same motor to always write to the next line.

The variables are

uint8_t myTestData[ 0 ];

int currentRotationM1 = 0;
int currentRotationM2 = 0;
char buffer[50];


How does the output in your post relate to the code you are showing us? In the code there is no Motor1… in the sprintf commands. in the code, all motors are named on their location?

I am missing the connection between the two.

sorry, that was just a quick example, the picture is my actual code. “farRight” would be Motor1.

so are you saying the file only has one line in it ? can you post an example of what the file contents are here ?

1 Like
     farRight.spinFor(directionType::fwd, 329, vex::rotationUnits::deg); 
     middleRight.spinFor(directionType::fwd, 252, vex::rotationUnits::deg); 
     middleLeft.spinFor(directionType::fwd, 285, vex::rotationUnits::deg); 
     farLeft.spinFor(directionType::fwd, 278, vex::rotationUnits::deg); 

This is the output as seen in the code above I have 4 motors all printing to the SDcard. After I print once it prints this, If i print it more than once the code updates the motors. For example(below)

farRight.spinFor(directionType::fwd, 329, vex::rotationUnits::deg); 

the code above will be overwritten by the one below on the same line. I want it to print on different lines so it doesn’t get overwritten.

farRight.spinFor(directionType::fwd, 400, vex::rotationUnits::deg);

same thing happens for all other motors

you call saveFile as the first line in the code you posted, that will always create a new file.


I thought I had tried removing that, but I must’ve been wrong thank you for your help again!