Search code examples
arduinoserial-portuart

How to use multiple Software Serial in Arduino nano?


I'm working on a project that needs to use at least 2 serial communications (2 TXs and RXs) alternately and in different pins. I wonder if it is possible to program the Arduino Nano for this task. I conducted research on the internet and saw that the processor that hardware (ATmega328) has only one UART, and by default this Arduino has dedicated 1 pin TX and one RX, but also saw that it would be possible in the Arduino UNO, which has the same processor, work with 2 serial communications using the SoftwareSerial library, it would be possible that the Arduino Nano?


Solution

  • Yes you can use Software Serial library for multiple Serial communication.

    As declared by https://www.arduino.cc/en/Main/ArduinoBoardNano using this method:

    #include <SoftwareSerial.h>
    
    SoftwareSerial mySerial(10, 11); // RX, TX
    SoftwareSerial mySerial1(8, 9); // RX, TX