I have a Parallax GPS module and a Sparkfun serial-enabled LCD. When I have them both running, I must "begin(9600)" the LCD first or else the GPS doesn't talk. I have attached the code I used to test it. This version works. Why does it make a difference??
Because I want to learn how to use that feature. I wrote it originally to use the extra Serial Ports the Mega has and that worked. I just wanted to know if I overlooked something in the setup.
It's probably because only one 'listener' is active at a time. If you do the lcd.begin() second, it will make that the active 'listener' and anything sent to gps will be discarded. To test the theory, you could try:
You are right! That worked. If you had an application that required monitoring multiple serial lines for input, could you not do that? Could you commutate the "listener" through the list of lines watching for input?
dxw00d:
Yes, you could do that. The problem is that the non-listening ports are not buffered, so anything sent to a port while it isn't listening is lost.
Keep in mind that's only for software serial ports. The hardware ports (UARTs) don't have that limitation, so it's back to using the hardware serial ports on the ATmega 2560 ...