BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Esp32 wifi & sim800

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.

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…

Pete.