Multiple instances of NewSoftSerial and the need for simultaneous reads

:roll_eyes:

I have a GPS device and a cellular shield connected to an Uno. I am using NewSoftSerial to communicate wiht both devices.

NewSoftSerial cell(2,3); 
NewSoftSerial gpsd(4,5);

Simple concept: The cellular shield connects to our server via TCP and sends GPS coordinates every minute.

So far, everything is cool. I can connect via TCP and send messages. I can also get the GPS data from the GPS device. But i can't seem to do both :~

From what i have read the ONLY solution is to connect to one device, read the data for x time and then switch to the other device and read that data for x time.

I guess that would work but for that fact that our server also sends data to the cellular shield with commands to do things like (immobilise, open doors etc).

If the software is reading the GPS device at the same time as a command is sent to the cellular device then the command is not read and so is missed.

It would seem the only way to achieve this is to use the Mega as that has multiple RX/TX pins - is that right?

But I was really hoping to stick to one Arduino device (and that ultimately being the Pro Mini upon final production for power and space reasons).

So is there another solution that anyone can see that i am missing here that would NOT use 2 instances of NSS?

Come on Paul - hit me with it :stuck_out_tongue: 8)

Might be answering my own question here, but...

I suppose i could use the built in Serial feature on pins 0 and 1 for one of the devises and NewSoftSerial for the the other device on pins 2 and 3?

Only problem would be that i couldn't see what the output was in the Serial Monitor.

But then i COULD use the Mega to test all the code and debug and then simply change the code to use Serial when reverting back to the Uno or Mini Pro....

Still after a better solution though if anyone has one!

It would seem the only way to achieve this is to use the Mega as that has multiple RX/TX pins - is that right?

Yes, it is. NewSoftSerial is great for a lot of things, but for simultaneous, multiple serial device access, you really need hardware.

But I was really hoping to stick to one Arduino device (and that ultimately being the Pro Mini upon final production for power and space reasons).

There are other devices that have multiple (not 4, but more than 1) hardware serial ports. Ask Crossroads for details.