Dear Friends,
I am trying to receive the SMS to A6 IoT GSM module, and try to read that sms over serial port. I am not able to receive the data over the serial port..
I am using this GSM module: https://www.aliexpress.com/item/mini-A6-GPRS-GSM-Kit-Wireless-Extension-Module-Board-Antenna-Tested-Worldwide-Store-for-SIM800L/32710017861.html
The code is as per below:
#include <SoftwareSerial.h>
#define GSM_RX 2 // Arduino pin 2 to UTX
#define GSM_TX 3 // Arduino pin 3 to URX
SoftwareSerial mySerial(GSM_RX, GSM_TX);
//char msg;
String msg;
void setup()
{
pinMode(4, OUTPUT);
Serial.begin(9600);
mySerial.begin(115200); // Setting the baud rate of GSM Module
delay(1000);
//mySerial.print("AT+CMGF=1r"); // set SMS mode to text
mySerial.print("AT+CMGF=1\r"); // set SMS mode to text
delay(200);
Serial.println("AT+CSMS=1\r");
delay(200);
mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
//mySerial.print("AT+CNMI=2,2,0,0,0\r");
//mySerial.print("AT+CNMI=1,2,0,0,0\r"); // AT Command to receive a live SMS
delay(100);
Serial.println("Ready");
}
void loop()
{
if (mySerial.available()>0)
{
// digitalWrite(4, HIGH);
msg=mySerial.readString();
delay(20);
Serial.print(msg);
}
}
Please help on this..
Thanks
Rakesh Patel
