What’s wrong with this code? I’m trying to print real-time motor velocity and temperature to the brain and velocity to the controller screen but it’s spitting out random numbers that change randomly after “RPM:” and after “Temp:”.
Here is my code:
int flywheelStatDisp(){
Brain.Screen.setFont(vex::fontType::mono40);
while (true){
Controller.Screen.clearLine(3);
Controller.Screen.setCursor(3,0);
Controller.Screen.print(“RPM:%d”,flywheel.velocity(vex::velocityUnits::rpm));
Multiply by some power of 10, round it off, then divide by the same power of 10. Print that result. Usually works. Most print format strings don’t have rounding specifiers built in.
Brain.Screen.Print does not support the complete list of formats shown, only the most common ones. however, using the standard library sprintf to create a string should.