i want the gsm module to read for incoming messages i test the module it calls it sends message but it didn't not display for me the message read , this is my code for reading message :
#include <SoftwareSerial.h>
// Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(10, 11); // SIM800L Tx & Rx connected to Arduino #10 & #11
void setup() {
// Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
// Begin serial communication with Arduino and SIM800L
mySerial.begin(9600);
Serial.println("Initializing...");
delay(2000); // Increase delay for initialization
sendATCommand("AT"); // Once the handshake test is successful, it will back to OK
sendATCommand("AT+CMGF=1"); // Configuring TEXT mode
sendATCommand("AT+CNMI=1,2,0,0,0"); // Decides how newly arrived SMS messages should be handled
}
void loop() {
updateSerial();
}
void updateSerial() {
delay(500);
while (Serial.available()) {
mySerial.write(Serial.read()); // Forward what Serial received to Software Serial Port
}
while (mySerial.available()) {
Serial.write(mySerial.read()); // Forward what Software Serial received to Serial Port
}
}
void sendATCommand(const char* cmd) {
mySerial.println(cmd); // Send the AT command
delay(2000); // Wait for a response (increase if needed)
// Read and display the response from SIM800L
String response = "";
while (mySerial.available()) {
response += char(mySerial.read());
}
Serial.print("Command: ");
Serial.println(cmd);
Serial.print("Response: ");
Serial.println(response);
}
and this is the output :13:03:45.451 -> Initializing...
Command: AT
Response:
Command: AT+CMGF=1
Response:
Command: AT+CNMI=1,2,0,0,0
Response:
i'm using arduino nano , sim800l and power supply 3.3v