Hi,
I'm still very new to Arduino, but steadily working on improving my skills. However, I've reached a block with the latest one, using ESP32 and SIM800L.
Basically, I'm using Preferences.h to store the phone numbers and passwords which the rest of the code will use to send messages as necessary. However, I keep getting errors relating to string/char/char* incompatibility. Could anybody take a lookj, and see where I am going wrong please? I've been round teh hjouses so many times, I can't see the wood for the trees!
#include <Sim800L.h>
#include <SoftwareSerial.h>
#include <Preferences.h>
Preferences Prefs; // Instance of Preferences to store details
#define RX 10 // RX pin for Software Serial
#define TX 11 // TX pin for Software Serial
bool error; // Return from sendSms command
Sim800L GSM(RX, TX); // Set up SIM800 module
void setup() {
Serial.begin(9600);
Prefs.begin("RoccoMax", true); // Open namespace in Read-only mode
bool prefinit = Prefs.isKey("tpinit"); // Check for first run
if (prefinit == false) {
Prefs.end();
Prefs.begin("RoccoMax", false);
Prefs.putString("UserNo", "+44xxxxxxxxxx");
Prefs.putString("UserPW", "123456");
Prefs.putString("UnitID", "SKMT001");
Prefs.putBool("tpinit", true);
Prefs.end();
Prefs.begin("RoccoMax", false);
}
number = Prefs.getString("UserNo") ;
GSM.begin(9600); // Start GSM module
GSM.delAllSms(); // Clear any texts in memory
error = GSM.sendSms(number, "GSM Module Ready");
Serial.println(error);
Serial.println("GSM ready");
}
void loop() {
byte index = GSM.checkForSMS();
if (index != 0) {
Serial.println(GSM.readSms(index));
}
}
Thanks
Gary