Dear all,
I am having an issue with the watch dog. I am trying to read messages from an A6 GSM module using the software.serial but my Esp8266 (Wemos D1 mini) keeps crashing even when I use yield() and delays. I think it is readString() command that holds up the module but any hints with what can be done to get the code to run, beside changing MCU type?
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
String state = "initing";
#define powerGSMPin D0
SoftwareSerial A6board (D3, D4);
void setup() {
Serial.begin(115200);
A6board.begin(9600);
pinMode(powerGSMPin, OUTPUT);
digitalWrite(powerGSMPin, LOW);
delay(100);
digitalWrite(powerGSMPin, HIGH);
}
void loop() {
while(state == "initing" || state == "sms_mode") {
delay(500);
if (A6board.available()) {
delay(1);
Serial.println("reading A6");
String recievedA6 = A6board.readString();
delay(1);
Serial.println(recievedA6);
// if(state == "initing" && recievedA6.indexOf("+CREG: 5") >= 0) {
// Serial.println("Mode sms");
// state = "sms_mode";
// delay(2000);
// A6board.println("AT+CMGF=1");
// } else if(state == "sms_mode" && recievedA6.indexOf("OK") >= 0) {
// state = "ready";
// Serial.println("Ready!");
// }
}
delay(50);
yield();
}
}
Thanks