I often find it useful to use the PlayTone API call for debugging. For example if I have more than one task running, I might assign a different tone to each task and have each of the tasks play its assigned tone on entry. Sometimes, when I do this, I hear the tones in the sequence I expect, but sometimes I don't. In the latter case, this gives me an important clue for debugging.
The same technique can be applied to function calls as well. This can tell whether or not functions are being called. Again, an important clue for debugging.
Note that there are named constants for both the frequency arg and the duration arg.
rrawat wrote:Mr Hansen:
I find the NXT watch list most convenient
however, i cannot find the variable i want to watch in the drop down expression list.
what if i just type the variable in the expression space; will it work??
Local variables are decorated with the name of the function or task in which they are defined. Also with the nesting level, depending on whether the variable declaration is inside a block statement of some kind. Also with separators and underscores. I forgot to attach the sample I was using to grab the screenshots.
The global variables are undecorated. In this example the variable "i" that is declared at the top of task main will be called __main_7qG2_i_7qG2_000 and the variable "i" that is declared inside the "for" loop will be called __main_7qG2_i_7qG2_002 (since it is nested 2 levels deep). All variables used within your program, global or local, will be listed in the drop down list. You just need to know the decoration scheme so that you can find your local variable.
Several options/features of the NXT Watch list are not fully implemented yet so don't be surprised if not everything works. Watching arrays is still very hard to do successfully. The same goes for watching a user-defined struct type.