Reading GPS and Incremental Rotary Encoder by MEGA 2560

Dear All Hello,

I am new in forums, I am working on a project of reading GPS co-ordinates and Rotary Encoder pulses on XBEE or BT. Currently I am using two Arduino mega board. With Ist board I am sending data of GPS by BT/XBEE pairing to Laptop Serial port. And with 2nd board I am sending data of Rotary Encoder (500 PPR) pulse by BT/XBEE pairing to Laptop serial port.

but I am unable to send both data same time.

We need following data on COM port by XBEE

1) Latitude 2. Longitude 3) No. of Satellite 4) Real Time. 5) Encoder pulses 6) Battery voltage

I want to use a Mega 2560 (or any other suggested) board to send data on one serial port.

Please help me in this regard and provide me source code.

You can't make two devices talk to one serial port.

PaulS:
You can’t make two devices talk to one serial port.

Perhaps the OP means that he wants to take in readings from two different devices and merge the data for output as a single stream?

abdulhadi_:
but I am unable to send both data same time.

Without seeing the code that represents your best attempt it is impossible to know what might be the problem.

And please use the code button </> so your code looks like this and is easy to copy to a text editor

…R

Dear Robin Sir,

I have attached two codes which I found on Arduino forum.

I am using both code and working fine. but I dint know to add two codes.

I am tacking data on my laptop by TWO Boards at TWO different port. This is increasing my cost.

I wish to use ONE board with GPS and XBEE shield to transfer my data on one PORT.

Please advice accordingly.

Regrads

Ublox_GPS_Sheild.ino (2.02 KB)

MHE_Encoder.ino (381 Bytes)

I was hoping you would post your attempt at the merged code.

Try to apply the concept in this Simple Merge Demo.

...R