

Once you connect your device to a PC running the Arduino IDE software, you can use the serial monitor to communicate with the board.
#Arduino serial port monitor code
This code creates a virtual serial port using pins 10 and 11 as the RX and TX ports, respectively.

set the data rate for the SoftwareSerial port Open serial communications and wait for port to open: SoftwareSerial mySerial(10, 11) // RX, TX To better understand the idea, we can look at Tom Igoe’s public domain example code here:
#Arduino serial port monitor software
The Arduino Software Serial library will allow you to use other digital pins, supplemented by software that replaces the RX and TX functions, to expand your board’s serial connectivity. If you still need more serial ports than the built-in ones provided by your board, you have another option. The Arduino website has a detailed breakdown of the various serial ports and required adapters and connections by model on its website. To use the extra serial pins (pins 18 and 19 on the Arduino Due, for instance), to communicate with your PC, make sure you have a USB-to-serial adapter, as the extra pins are not connected to the board’s built-in adapter. Keep in mind that if you use these pins for serial data transmission, they will be unavailable for digital I/O. The port on your board called Serial (Serial1 if you have USB) communicates via pins 0 and 1 (RX and TX, respectively). The other standard serial ports begin with “Serial1” and number progressively from there. In USB-enabled boards, we refer to the USB as Serial. Other boards, such as the Leonardo, also have serial communication in the form of a USB) port. Every Arduino board has at least one serial port, and many have additional built-in serial ports (Serial1, Serial2, etc.).
