Arduino Forum

Development => Other Software Development => Topic started by: cadcoke5 on Nov 18, 2016, 04:48 pm

Title: Software Serial page-adding which parts go where
Post by: cadcoke5 on Nov 18, 2016, 04:48 pm
I eventually figured it out, but it took quite a while.  I suggest you add the following to the page that describes the Software Serial.

There are 3 necessary statements to make the Software Serial ports work. Each must go into the specific area of the program as shown below. [Note that I am not certain that the MySerial.print can only be used in the Loop area. Can it also be used in the Setup area? EDIT, i FOUND AN EXAMPLE THAT SHOWS THAT IT IS OK TO USE SEND/RECEIVE DATA COMMANDS IN BOTH THE SETUP OR LOOP AREAS. -Joe]

Code: [Select]
#include <SoftwareSerial.h>    //Load the software serial library.

SoftwareSerial MySerial(11, 10);   //Define software serial (RX,TX)

void setup() {

  MySerial.begin(9600); // Start the Software Serial port, and set baud rate


void loop() {

/* Commands that actually use the Software Serial port go in the void Loop area.
 * any of the sub-function can be use, here we use the print function.
  MySerial.print("hello World"); // Send a text message out the Software Serial port.


I will mention another minor issue.  I would prefer that all the sub-functions, such as the MySerial.print, MySerial.println, etc. be explained on the same page, rather than each being a link to a new page.