You can use the writeDebugStream and writeDebugStreamLine commands (
found here on our wiki) to write values to the Debug Stream debugger window; you can write messages and/or sensor values directly to the debugger window. For example:
This program has a Sonar sensor on port 1 (aptly named 'sonar'). It also creates an integer called 'foo' that we will use as a placeholder for the elapsed time.
The first line of code, 'clearDebugStream();' clears any old values from the Debug Stream debugger window. The second line, ClearTimer(T1) clears out the timer we will be using and the while(true) loop keeps the program running indefinitely. The integer foo is then assigned the value of the timer T1, divided by 10 to give whole numbers.
The writeDebugStreamLine tells the program to make a new line that contains the text "The sonar value at", a decimal value, "seconds is ", and another decimal value (the %d means 'decimal value'; %f, for instance, stands for float. There is a
full listing of the supported types on our wiki.) After the text are the parameters for the first %d value and the second %d value; in this case the variable 'foo' (which holds the value of the T1 timer) and the value of the Sonar sensor. We then wait for 1 second and loop through again.
The result result, which appears in the Debug Stream window, looks like this:
You can modify the code or use the writeDebugStream commands in custom code to display whatever you need it to. You can then copy and paste the information to another document (an Excel spreadsheet, for instance) and save it locally.
_________________Check out our
Blog! And our
Facebook page!
Need help? Take a look at our
Wiki and our
Forums.I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe? ~ Carly Rae Jepsen parody