Software Serial on Arduino zero?

Hello, I been searching around for if anyone else has this problem using SoftwareSerial on an arduino zero board. It looks like a lot of people having this problem and So I'm as well. I have a GSM module I'm trying to use on the arduino zero board having this problem. Is there a way to do software serisl on the arduino zero board.

This is the sketch I'm using that I found online that will work with my GSM model.


#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);
int timeout;
void setup(){
  Serial.begin(9600);
  mySerial.begin(9600);
  Serial.println("Type\n s) to send an SMS\n r) to receive an SMS\n c) to make a call");
  Serial.println("Initializing..."); 
  delay(1000);
  mySerial.println("AT");
}

void loop(){
  if (Serial.available() > 0){
    switch (Serial.read()){
      case 's':
        SendMessage();
        break;
      case 'r':
        RecieveMessage();
        break;
      case 'c':
        CallNumber();
        break;
    }
 }
  if (mySerial.available()) {
    delay(1000);
    Serial.println(mySerial.readString());
  }
}

String readSerial(){
  delay(100);
  if (mySerial.available()) {
    return mySerial.readString();
  }
}

void CallNumber() {
  mySerial.println("ATD+ +1xxxxxxxxx;");
  Serial.println(readSerial());
  delay(20000); 
  mySerial.println("ATH"); 
  delay(200);
  Serial.println(readSerial());
}
void SendMessage(){
  mySerial.println("AT+CMGF=1"); 
  Serial.println(readSerial());
  mySerial.println("AT+CMGS=\"+1xxxxxxxxx\"");
  Serial.println(readSerial());
  mySerial.println("Hi this is veron");
  mySerial.println((char)26);
  Serial.println(readSerial());
}

void RecieveMessage(){
  Serial.println ("SIM800C Read an SMS");
  mySerial.println("AT+CMGF=1");
  Serial.println(readSerial());
  mySerial.println("AT+CNMI=1,2,0,0,0"); 
  Serial.println(readSerial());
}

Joseph

google is always worth a 5 minute search

use Serial1

1 Like

You may want to see this thread too: Arduino Zero - SoftwareSerial library - #17 by MartinL

Hi @josephchrzempiec

I believe that awhile ago Arduino.org did write a SoftwareSerial library for their M0 Pro, but I'm not sure whether it's still available anymore?

The reason why there hasn't generally been a need for SoftwareSerial on the SAMD21 boards, is because the microcontroller has spare serial communication ports that can be configured as additional hardware SPI, I2C and Serial ports.

Adafruit have an excellent article about it here:

Hello all, I'm still working at it. The only 2 boards I have are the D1 mini and the Arduino zero board. I choose to use the zero board because on the d1 mini When I use D2 or D3 on the board for some odd reason they don't work and I can not get nothing from serial monitor.

Only 15 minutes ago I got I found one of my old FTDI breakout broards. So I searched for a way just to use FTDI. I saw in the past someone did it once using an FTDI and they got it to work. So I tried it and it works. I'm using serial monitor to send AT commands and that works. I can't for the like of me get the zero board working. and I think the D3 on the D1 mini board is not working I can even get a blink led on it. D2 works no problem even with a led blink.

P.s.s I think I will for now stick with the FTDI breakout board and see what happens. Thsnk you all for the help.

did you really understand
with the Arduino zero

don't use

## software

-serial

use

hardware

-serial

by naming it
serial1
serial-ONE

On a zero, "Serial1" is pins 0/1.
But pins 2 and 3 are Sercom2, and you can add that as an additional serial port using the Adafruit instructions (or maybe using GitHub - WestfW/Arduino_sercomlib (but the documentation there seems to be lagging.))

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.