Monday, July 18, 2016

Filled Under: , ,

MultiSerialMega

Arduino Arduino UNO R3 library

Sometimes, one serial port just isn't enough! When trying to communicate with multiple serial enabled devices, while also sending info back to the main serial window, a few extra RX/TX ports can be a welcomed thing. This example makes use of one of Arduino Mega's 3 auxiliary serial ports, routing any incoming data read on that connection straight to the main TX line, and, in turn, to the main serial window for you to view.

Step 1: What You Need?

1 x Arduino Mega Board 
1 x Serial Enabled Device (a Xbee Radio, a Bluetooth module, or RFID Reader or another board, for instance).

1 x USB Type-B Cable 
Female-to-Male Jumper Wires 


You can buy Arduino Compatible UNO Ultimate Starter Kit / Learning Kit at here.

Don't have components? Don't worry. Just click the component's name. 


Step 2: Build Your Circuit.

After checking the data sheet of whatever serial enabled device you choose to use for this example, make sure that it is both properly wired and powered. Connect the RX pin and TX pins of your device to the TX1 and RX1 pins of your Mega, as shown in the schematic below.

Make sure that your Mega is connected to your computer, via USB, to enable serial communication.

Step 3: Upload The Code.

1. Select the Arduino board type: Select Tools >> Board >> Select your correct Arduino board used.

2. Find the port number by accessing device manager on Windows. See the section Port (COM&LPT) and look for an open port named "Arduino Uno (COMxx)". If you are using a different board, you will find a name accordingly. What matters is the xx in COMxx part. In my case, it's COM3. So my port number is 3.

Select the right port: Tools >> Port >> Select the port number.

3. You can find this code in the example of Arduino IDE.
Select File >> Examples >> 04.Communication >> MultiSerial

Click press the "upload" button (see the button with right arrow mark).

This sketch assumes that you connect your serial enabled device is attached to TX1 and RX1.

Download: 

Arduino IDE


Sources:https://www.arduino.cc/en/Tutorial/MultiSerialMega

Unknown

Author & Editor

My Robot Education Sdn. Bhd. (Robotedu.my) was founded in 2015 as the first robotics education centre in Malaysia to provide Arduino-based robotics courses for youths. Our vision is to be able to provide robotics education to every youth in Malaysia.

0 comments:

Post a Comment

 

  • Copyright © Arduino Tutorial ™ is a registered trademark.
    Designed by Templateism. Hosted on Blogger Templates.