Hello,
I need to use two (or more) hardware UARTs on Arduino MEGA 2560. What commands should I use to do this?
Hello,
I need to use two (or more) hardware UARTs on Arduino MEGA 2560. What commands should I use to do this?
Just like you use this to print to the Serial Monitor...
Serial.println( "Hello" );
...you can do any or all of these on the Mega:
Serial1.println( "Hello" );
Serial2.println( "Hello" );
Serial3.println( "Hello" );
Of course, you have to start them just like Serial:
Serial1.begin( 9600 );
Serial2.begin( 115200 );
Serial3.println( 4800 );
Make sure you're using the corrext TX1/RX1, TX2/RX2 or TX3/RX3 pins to talk to the other device.
Cheers,
/dev
Exact same commands as you normally would. Only difference is adding a number behind Serial if it isn't the default port.
Also remember that only the first UART is capable of sending data to the computer.