Society of Robots - Robot Forum

Software => Software => Topic started by: Aberg098 on August 12, 2010, 07:26:48 AM

Title: rprintf Question
Post by: Aberg098 on August 12, 2010, 07:26:48 AM
I have a 3 axis accelerometer on an AxonII. Currently, I am outputting the values using rprintf back to my desktop like so:

Code: [Select]
rprintf("Acceleration x = %d\n",accel.accelerometer.x_axis_mG);
rprintf("Acceleration y = %d\n",accel.accelerometer.y_axis_mG);
rprintf("Acceleration z = %d\n",accel.accelerometer.z_axis_mG);

and this reads on hyperterminal as:

Acceleration x = 890
Acceleration y = 356
Acceleration z = 100

If I wanted the output format to be all in one line, say something more streamlined:

x= 890 y= 356 z=100

How should I go about?
Title: Re: rprintf Question
Post by: Razor Concepts on August 12, 2010, 07:47:54 AM
Get rid of the \n on the first two lines but keep it on the third.

Or,

Code: [Select]
rprintf("x = %d y = %d z = %d\n",accel.accelerometer.x_axis_mG,accel.accelerometer.y_axis_mG,accel.accelerometer.z_axis_mG);
Title: Re: rprintf Question
Post by: Aberg098 on August 12, 2010, 07:55:54 AM
Thanks, that example is just what I was looking for!