Need help with some weird code output

I had this code working a little bit ago but then it just gave me weird outputs.
image
image
Also I have an hspeed floating point number at the top.
Also first 2 lines of code are displaying the current rpm and the rest is for displaying the max rpm reached.

What’s your question?

Why it want working and was giving weird numbers but I figured it out by switching the greater than size around

Is hspeed a float or a double ? It looks like print is confused as to what type it is, best solution is to use print with formatted output, something like

Brain.Screen.print("%.2f", hspeed);
3 Likes

I figured it out but it was weird why it went to that number. I suspect the floating point number because when I set it to 0 manually it would stay at zero but if I left it blank it went to that number.

was it a local or global variable ? local variables are not automatically initialized.

1 Like

It was in the user control loop
Edit: I meant it was setup like this
int hspeed;