I was trying to print the motor rotations and Battery capacity to the cortex. However, there is a small problem that is annoying me a bit. here is the code:
Blockquote
#include “vex.h”
#include “user/pragma.h”
#include “user/motor_config.h”
// shows battery left, chassis motor rotation
// used for auton mainly / debug
void GUI_set_up()
{
Brain.Screen.setFillColor(black);
Brain.Screen.setPenColor (white);
Brain.Screen.setFont (propM);
Brain.Screen.setPenWidth (20);
}
void basic_info()
{
GUI_set_up();
Brain.Screen.setCursor(1,1);
Brain.Screen.print(“Battery: %d%”, Brain.Battery.capacity());
Brain.Screen.setCursor(3,1);
Brain.Screen.print(“Rightfront: %d”, rotate(rightfront));
Brain.Screen.setCursor(5,1);
Brain.Screen.print(“RightBack: %d”, rotate(rightback));
Brain.Screen.setCursor(7,1);
Brain.Screen.print(“LeftFront: %d”, rotate(leftfront));
Brain.Screen.setCursor(9,1);
Brain.Screen.print(“LeftBack: %d”, rotate(leftback));
Brain.Screen.render();
}
The basic idea is to print
Battery: value
Right front: value
Right back: value
Left front: value
Left back: value
Blockquote
However, when there is a digit change in the value it does not remove the last digit.
For example, if the previous rotation value for the right front was 1245 and it changes to 800, it somehow prints 8005 which is very confusing.