Variables Not Showing in debugger Windows

I am attempting to test my RPM speed, yet I am unable to because i cant see it while the program is running. I have tied going into the local and global variables list but it isn’t there. The variable I’m trying to look at is an int. Is there a way I can fix this, or is it something that i must do to robotC

Do you have the variable defined globally or locally? To see if it a RobotC issue, you can put this (or any other variable name and type) under your #pragmas:


//#pragmas, #defines, #includes here (if any)
int foo = 0;

The placement is not particularly important, as long as the variable is defined before the first set of curly braces begins. This variable should show up in the global variables window. If it doesn’t, then RobotC has an issue. If it does, then check how and where you define the variable you want to see. You can also use an LCD screen, or the digital LCD screen, and print the value to it, if you know how to do so.

As a little hack, you could print the int to debugstream. (The Debugstream is one of the debugger windows)

E.g.


int foo = 100;
writeDebugStreamLine("RPM: %d", foo);

Just use ‘%d’ to define where you want to rpm value then in order put the variables separated, by, commas.

Local variables are only shown if you stop the program while in the function that they are defined. Put a breakpoint in the function to stop the program.

What does %something mean? The format string has to be appropriate for the variable, for example, use %d to print an integer in decimal format, use %x to print an integer in hexadecimal format. %r is a pretty obscure format specifier that I don’t think is used in ROBOTC (or any standard library I’ve ever used).

Whoops :stuck_out_tongue: Just a mistake on my part :smiley: Today my thoughts are on absentminded clouds… hmmm. Haha

I find this attachment pretty helpful. I usually use %f when printing values to the debug stream.
Number formatting.jpg