I wrote this code
It controls the temperature of my aquarium.
I have a problem
when I turn on the hardware and I do not have internet the code hangs
is waiting for the intern
is it possible to run the temperature control routine without the internet?
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include<DallasTemperature.h>
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
int Ventilador = 5; // FAN
int Aquecedor = 4; // heater
/* TIMER */
#include <SimpleTimer.h>
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “key”;
float temp;
// Your WiFi credentials.
// Set password to “” for open networks.
char ssid[] = “rede”;
char pass[] = “passs”;
WidgetLED led1(V1);
WidgetLED led2(V2);
void setup()
{
// Debug console
Serial.begin(9600);
DS18B20.begin();
timer.setInterval(1000L, getSendData);
pinMode(Aquecedor, OUTPUT);
pinMode(Ventilador, OUTPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
timer.run();
Blynk.run();
if ( temp > 27.00 ) {
digitalWrite(Ventilador,HIGH);
led2.on();
}
if ( temp < 26.50 ){
digitalWrite(Ventilador,LOW);
led2.off();
}
if ( temp < 24.50 ) {
digitalWrite(Aquecedor,HIGH);
led1.on();
}
if ( temp > 25.00 ) {
digitalWrite(Aquecedor,LOW);
led1.off();
}
}
/***************************************************
- Send Sensor data to Blynk
**************************************************/
void getSendData()
{
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
Serial.println(temp);
Blynk.virtualWrite(10, temp); //virtual pin V10
}