Debug Stream

Hey all,

We are trying to learn how to use the debug stream. We are able to get variables to “print” to the debug stream, for example:


writeDebugStreamLine("%i", leftdelta_ms);
writeDebugStreamLine("%i", leftdelta_enc);
writeDebugStreamLine("%i", leftmotor_velocity);

However, this leaves us with a string of numbers such as:

20
16
155
20
15
158
20
16
154

I understand why it is showing up like this, but it’s not very useful for exporting to excel for graphing because all of the different variables data would be in the same column. Is there a way to get it to print to the debug stream in a way that is easier to get into a spreadsheet for graphing?

Perhaps a way to get it to print like:

20, 16, 155
20, 15, 158
20, 16,154

Because then in excel you could parse at the commas to different cells. I’m thinking this is an easy thing to do, but I just don’t know what to do.

Alternatively we can just run one variable at a time in the debug stream but then we aren’t really comparing apples to apples when we graph them over the top of each other because each came from a physically different test.

Thanks.


writeDebugStreamLine("%d, %d, %d", leftdelta_ms, leftdelta_enc, leftmotor_velocity);

%d and %i do the same thing, %d is more common. They are both format specifiers for a signed integer.

Alternatively, this also works (leave off Line on the first two calls)

writeDebugStream("%i,", leftdelta_ms);
writeDebugStream("%i,", leftdelta_enc);
writeDebugStreamLine("%i", leftmotor_velocity);

So obvious once I see it. Thanks yet again @jpearman!