The following is code from the sim7600test.ino file
Code: Select all
#include <lib/FreematicsPlus.h>
// testing URL: https://hub.freematics.com/test
#define SERVER_HOST "hub.freematics.com"
#define SERVER_PORT 443
#define SERVER_PATH "/test"
#define CELL_APN "hologram"
#define CONN_TIMEOUT 5000
FreematicsESP32 sys;
HTTPClientSIM7600 net;
int errors = 0;
bool init_net()
{
Serial.print("Init cellular module...");
if (net.begin(&sys)) {
Serial.print(net.deviceName());
Serial.println(" OK");
} else {
Serial.println("NO");
return false;
}
Serial.print("IMEI:");
Serial.println(net.IMEI);
if (net.checkSIM()) {
Serial.println("SIM Card OK");
} else {
Serial.println("No SIM Card");
}
Serial.print("Registering on network...");
if (net.setup(CELL_APN)) {
Serial.println("OK");
} else {
Serial.println("NO");
return false;
}
String op = net.getOperatorName();
if (op.length()) {
Serial.print("Operator:");
Serial.println(op);
}
Serial.print("Obtaining IP address...");
String ip = net.getIP();
if (ip) {
Serial.println(ip);
} else {
Serial.println("N/A");
}
int signal = net.getSignal();
if (signal) {
Serial.print("RSSI:");
Serial.print(signal);
Serial.println("dBm");
}
Serial.print("Init HTTPS stack...");
if (net.open()) {
Serial.println("OK");
} else {
Serial.println("NO");
}
return true;
}
void setup()
{
Serial.begin(115200);
// use following for Freematics ONE+
sys.begin();
// use following for Freematics Esprit or other ESP32 dev board
//sys.xbBegin(115200, 16, 17);
// initialize cellular module
while (!init_net());
}
void loop()
{
if (errors > 10) {
// re-initialize cellular module
net.end();
if (init_net()) {
Serial.println("OK");
errors = 0;
} else {
Serial.println("NO");
delay(3000);
return;
}
}
//Lets test SMS (my added code)
{
Serial.write("AT+CMGF=1\r");
delay(500);
/*Number to send SMS to*/
Serial.print("AT+CMGS=\"+886123456789\"\r");
delay(500);
Serial.print("\rHELLO World from SMS\r\n");
delay(500);
Serial.write(0x1A);
Serial.print("Sent!!");
delay(1000);
Serial.println("Waiting 1 Minute...");
delay(60000);
}
Code: Select all
//Lets test SMS
{
Serial.write("AT+CMGF=1\r");
delay(500);
/*Number to send SMS to*/
Serial.print("AT+CMGS=\"+886123456789\"\r");
delay(500);
Serial.print("\rHELLO World from SMS\r\n");
delay(500);
Serial.write(0x1A);
Serial.print("Sent!!");
delay(1000);
Serial.println("Waiting 1 Minute...");
delay(60000);
}
Code: Select all
Init cellular module...SIM7600E-H OK
IMEI:12345678
SIM Card OK
Registering on network...OK
Operator:TW Mobile Hologram
Obtaining IP address...10.81.167.111
RSSI:-67dBm
Init HTTPS stack...OK
HELLO World from SMS
␚Sent!!Waiting 1 Minute...
Any help would be appreciated.