go_away

Author Topic: rprintf Question  (Read 877 times)

0 Members and 1 Guest are viewing this topic.

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
rprintf Question
« 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?

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: rprintf Question
« Reply #1 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);
« Last Edit: August 12, 2010, 07:49:16 AM by Razor Concepts »

Offline Aberg098Topic starter

  • Full Member
  • ***
  • Posts: 66
  • Helpful? 0
Re: rprintf Question
« Reply #2 on: August 12, 2010, 07:55:54 AM »
Thanks, that example is just what I was looking for!

 


Get Your Ad Here