Hi
Friends. I want to automatically when access to the system is lost. Reconnect to the system
I use sim800 and esp32
*I am currently successfully connecting to the network in a stup . But once the network is down, I can not reconnect to the network
I want it when my connection to the GSM network is lost and I do not have access to Blynk. Automatically connect to GSM and Blynk after a few minutes
my cod
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "TMPL32RWKy1E"
#define BLYNK_DEVICE_NAME "GSM"
#define LED 10
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_XBEE
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "skD_QKoTMfn2KJobfnIoeyVoKRGAzO-E";
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[] = "mtnirancell";
char user[] = "";
char pass[] = "";
// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(9,8); // RX, TX
//RX sim800 conecct to 8
//TX sim800 conecct to 9
TinyGsm modem(SerialAT);
BLYNK_WRITE(V0){
int pinvalue=param.asInt();
digitalWrite(LED,pinvalue);
}
void setup()
{
pinMode(LED,OUTPUT);
digitalWrite(LED,HIGH);
// Debug console
Serial.begin(9600);
delay(10);
// Set GSM module baud rate
SerialAT.begin(9600);
delay(3000);
// Restart takes quite some time
// To skip it, call init() instead of restart()
Serial.println("Initializing modem...");
modem.restart();
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");
Blynk.begin(auth, modem, apn, user, pass);
}
void loop()
{
Blynk.run();
}
Thanks.