How to time stamp data received via XBee on Raspberry Pi
<p>I have a FRDM k64F, which is sending magnetometer data to the Raspberry Pi. Both the devices are connected via a XBEE. I wanted to know how I can time stamp the data that is being sent to the Raspberry Pi and put it into a separate file?</p>

<p>so this is the code for the data being sent from the FRDM k64F via the XBee to Raspberry Pi</p>

<pre><code>#include "mbed.h"
#include "C12832.h" //for LCD
#include "FXOS8700Q.h"// for magnetometer

DigitalOut gpo(D0);
DigitalOut led(LED_RED);
Serial xbee(D1, D0);
C12832 shld_lcd (D11, D13, D12, D7, D10);
FXOS8700Q_mag mSensor(PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1);
MotionSensorDataUnits mData;

void setup() {
    xbee.baud(9600);
    }

    int main()
    {
        mSensor.enable();
        setup();
        while (1) {

            wait(5);
            mSensor.getAxis(mData);
                float mX = mData.x;
                float mY = mData.y;
                float mZ = mData.z;
                float mXYZ = (mX + mY + mZ)/3;
                shld_lcd.locate (1, 1);
                shld_lcd.printf("Magnetometer: %.2f \r \n", mXYZ);
                xbee.printf("Magnetometer: %.2f \r \n", mXYZ);
        }
    }
</code></pre>

<p>and the Raspberry Pi is able to read the data via the following command </p>

<pre><code>screen/dev/ttyAMMAO 9600
</code></pre>