J4l13n
November 18, 2020, 8:42pm
1
Hi ! ( salut )
I use a WROOM32 with WIFI and the SIM800 as a backup if there is no more WIFI connection.
What is the best way to do it?
I tried :
Blynk.begin (auth, ipWan, port);
but the compiler does not want it
the :
#include <Blynk.h>
not enough ?
thank you in advance
We need to see your complete code.
Pete.
J4l13n
November 18, 2020, 9:08pm
3
thx
here we go :
for WIFI :
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
char ipWan[] = "my.ip.wan.server";
uint16_t port = 8080;
byte test1;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass, my.ip.wan.server,port);
}
void loop()
{
Blynk.run();
Blynk.virtualWrite(V5, test1);
test1++;
}
and for sim
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2,3);
TinyGsm modem(SerialAT);
char apn[] = "apn";
char user[] = "user";
char pass[] = "pass";
char ipWan[] = "my.ip.wan.server";;
uint16_t port = 8080;
char auth[] = "YourAuthToken";
void setup()
{
SerialAT.begin(9600);
delay(3000);
Blynk.begin(auth, modem, apn,user, pass,ipWan, port);
}
void loop()
{
Blynk.run();
Blynk.virtualWrite(V5, test1);
test1++;
}
it works very well separately
Well, to begin with, having this in your void loop breaks the number 1 rule of Blynk…
Secondly, you need to explain more about what your combined code looks like, what specifically your compiler errors are, and maybe explain the logic of how your combined code is choosing which connection method to use.
Pete.
Also, you might want to take a look at this library…
This is the new library, adding to the current Blynk_WiFiManager. It’s designed to help you eliminate hardcoding your Blynk credentials in ESP32 and ESP8266 boards using GSM shield (SIM800, SIM900, etc).
You can update GSM Modem and Blynk Credentials any time you need to change via Configure Portal. Data are saved in SPIFFS or configurable locations in EEPROM.
If it cannot connect to the Blynk server in 30 seconds, it will switch to Configuration Mode. You will see your built-in LED turn…
Pete.