Hello
I have a disconnection every minute, I used SIM900, SIM800, M590 modules. Used cellular communication providers Beeline and Activ.
Has anyone gotten a stable connection with the server? Can I see the code?
Here is my code. Mega2560 + M590
#include <SimpleTimer.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
// Select your modem:
//#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
#define TINY_GSM_MODEM_M590 //сейчас работаем на M590 модуле
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
const char auth[] = "____________________________________";
// Your GPRS credentials
// Leave empty, if missing user or pass
const char apn[] = "internet";
const char user[] = "";
const char pass[] = "";
// Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial2
SimpleTimer timer;
#define OUT_LED 4 // мониторинг наличия связи с сервером
TinyGsm modem(SerialAT);
void sendOnOff() //эта функция выполняеться по таймеру периодически
{
static int temp;
digitalWrite(OUT_LED, HIGH);
temp = analogRead(A0); //датчик освещенности на улице
Serial.println(temp);
digitalWrite(OUT_LED, LOW);
}
void setup()
{
// Set console baud rate
Serial.begin(115200);
delay(10);
// Set GSM module baud rate
SerialAT.begin(115200);
delay(100);
pinMode(OUT_LED, OUTPUT);
// Restart takes quite some time
// To skip it, call init() instead of restart()
Serial.println("Initializing modem...");
modem.restart();
delay(10000); //ждем пока модем очухается
Blynk.begin(auth, modem, apn, user, pass);
timer.setInterval(2000L, sendOnOff); //
}
void loop()
{
Blynk.run();
timer.run();
}