Mega - TX/RX

Hey,

Have a quick question. Is it possible to do serial on two ports at the same time? I need to have the Mega talk to the PC on TX pin 1 and also hav ethe Mega talk to a Serial LCD on say pin 18, while also sending PWM signals to Pins 9-12 using the Servo.h library. My issue is this. When program runs. Screen just flashes wildly and servos just jitter. Part of my issue might be power. Screen needs 6v and 4 servos need 4.5v-6v. So I will try that with higher supplied voltage. But I think I still have serial conficts as well.

Do I need to delcare serial definitions for TX to PC since by default it sees serial traffic anyway on pins 1 and 2?

Code flow. LCD displays via serial . Enter x, from PC input Via USB serial port user enters x value. Value moves servo and loop. Seems like it should work.

Hope it makes sense.

Regards,
MadDawg

Hi,

you can use Serial, Serial1, Serial2 and Serial3 at the same time. There should'nt be any problems. There are no definitions necessary. (You can not use the pins as digital pins if used for Serial).

The only thing you have to do is to initialize the serial ports:

Serial.begin(9600);
Serial1.begin(9600);

for example.

Mike

Ah, then that is my issue. Not intilizing the port. Will hav eto look that up on defining a second serial port.

Thanks,

MadDawg