Hy guys!
I have some troubles at my project and I hope anyone can help me!
I want to do some measurements every 2h and send them to my local server. After that arduino should go in deep sleep. Measurements and transfer to the server works realy fine.
But I donât have any solution for the case if the connection to the server fails.
In that case the arduino tries to build up a connection to the server and drains my batteries.
So it would helpful if builing up the connection fails, that the arduino stop trying, skip the transfer and continue the code! At the next loop the arduino should try again to build up a connection to the server.
Below you see my basic sketch!
By the way: I tried everything with Blynk.config(), Bylnk.connect(), Bylnk.connect(15),âŠ
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
char auth[] = "XXXXXXX";
char apn[] = "";
char user[] = "";
char pass[] = "";
char server[] = "XXXXX.ddns.net";
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX
TinyGsm modem(SerialAT);
void setup()
{
Serial.begin(9600);
delay(10);
SerialAT.begin(9600);
}
void loop()
{
measurements(); // do some measurements int b,s,d,z,...
digitalWrite(4, HIGH); // start GSM modul
modem.restart();
Blynk.begin(auth, modem, apn, user, pass, server, 8080);
checkSignal();
delay(4000);
Blynk.virtualWrite(V0, "Let's go!");
Blynk.virtualWrite(V4, b);
Blynk.virtualWrite(V6, s);
Blynk.virtualWrite(V28, d);
Blynk.virtualWrite(V28, z);
Blynk.disconnect();
delay(2000);
digitalWrite(4, LOW); // shut down GSM modul
pwrDown(7200); //2h deep sleep
}
I am thankful for every help!