I’ve random and frequently disconnections with my WeMos D1 mini.
This is the serial monitor with DEBUG acttivated
[122038] >[14]tú[00|05]
[122039] >vr[00]13
[122040] >[14]tû[00|05]
[122040] >vr[00]14
[122387] >[0F]ÆG[00|0C]
[122387] >vw[00]39[00]17.800
[122388] BLYNK_WRITE(V39)
[122391] >[0F]ÆI[00|0B]
[122391] >vw[00]40[00]9.500
[122392] BLYNK_WRITE(V40)
[122396] >[0F]ÆK[00|0C]
[122396] >vw[00]41[00]15.883
[122396] BLYNK_WRITE(V41)
[123031] CHECK()
[123031] <[14|00]´[00|0B]vw[00]8[00]17.725
[123034] <[14|00]µ[00|15]vw[00]32[00]p[00]0[00]0[00]AUTOMAT.[00]
[123036] <[14|00]¶[00|13]vw[00]32[00]p[00]9[00]0[00]SPENTO[00]
[123038] <[14|00]·[00|16]vw[00]32[00]p[00]0[00]1[00]T:17.7°C[00]
[128044] Cmd error
[128047] Cmd skipped:20
[128048] Connecting to 192.168.1.189:8442
[128054] <[02|00|01|00] 2affa38aa6f245d39dff7ff0ff2ec4c7
[128058] BLYNK_CHECK_CONN()
[128058] Blynk disconnected!
[128059] HEARTHBEAT()
Failed to read from DHT sensor!
[128329] CHECK()
[128330] Cmd skipped:20
[128330] Cmd skipped:20
[128330] Cmd skipped:20
[128330] Cmd skipped:20
[128331] Cmd skipped:20
[128334] >[00|00|01|00]È
[128336] Ready (ping: 278ms).
[128338] <[11|00]¾[00]Gver[00]0.4.0[00]h-beat[00]10[00]buff-in[00]256[00]dev[00]Arduino[00]build[00]Nov 11 2016 10:27:39[00]
[128357] BLYNK_CONNECTED()
[128357] <[10|00]¿[00|04]vr[00]0
[128362] <[14|00]À[00|09]vw[00]32[00]clr
[128405] >[00|00]¾[00]È
[128406] >[14|00]¿[00|0F]
[128406] >vw[00]0[00]1478860205
[128406] Time sync: OK
… and my code …
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#define BLYNK_DEBUG
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Time.h>
#include "DHT.h"
#include <WidgetRTC.h>
#include <Adafruit_NeoPixel.h>
#define RGBLED D2
#define onBoardLED D3
#define relayPIN D1
#define DHTPIN D4
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, RGBLED, NEO_GRB + NEO_KHZ800);
WidgetRTC RTC;
WidgetLCD LCD(V32);
BLYNK_ATTACH_WIDGET(RTC, V0);
SimpleTimer myTimer;
char auth[] = "**************";
char ssid[] = "FRITZ!Box Fon WLAN 7390";
char pass[] = "**************";
char serv[] = "192.168.1.189";
char auth2[] = "*************";
char ssid2[] = "ABR_VIE-L09_049746";
char pass2[] = "*************";
char serv2[] = "192.168.1.188";
boolean blynkConnected;
boolean automatic;
boolean power;
boolean power_lastState;
boolean temperatureMode;
String fourLCDString[4];
float tmin;
float tmax;
float temperature;
float humidity;
float heatindex;
float temperatureArray[6];
float humidityArray[6];
float heatindexArray[6];
boolean enableArray[6];
byte RGB[3];
class timers {
public:
long startTimer;
long stopTimer;
boolean weekdays[7];
};
timers myTimers[6];
void setup() {
pinMode(relayPIN, OUTPUT);
digitalWrite(relayPIN, LOW);
pinMode(onBoardLED, OUTPUT);
digitalWrite(onBoardLED, HIGH);
blynkConnected = false;
automatic = true;
Serial.begin(115200);
debugMillis(F("DHTxx test!"));
dht.begin();
pixels.begin();
RGB[0] = 64;
RGB[1] = 0;
RGB[2] = 0;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
// Blynk.begin(auth2, ssid2, pass2, serv2, 8442);
Blynk.begin(auth, ssid, pass, serv, 8442);
RGB[0] = 0;
RGB[1] = 64;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
}
void debugMillis(String myString){
Serial.println("[" + String(millis()) + "] " + myString);
}
void simpleLCDrefresh(){
// LCD.clear();
LCD.print(0,0,fourLCDString[0]);
LCD.print(9,0,fourLCDString[1]);
LCD.print(0,1,fourLCDString[2]);
LCD.print(9,1,fourLCDString[3]);
}
byte timeDays2blynkDays(byte blynkWeekday) {
switch (blynkWeekday) {
case 1:
return 7;
break;
case 2:
return 1;
break;
case 3:
return 2;
break;
case 4:
return 3;
break;
case 5:
return 4;
break;
case 6:
return 5;
break;
case 7:
return 6;
break;
}
}
void readDHT_wrapper(boolean debug){
readDHT(debug);
}
boolean readDHT(boolean debug){
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
if (debug) Serial.println("\tFailed to read from DHT sensor!");
RGB[2] = 64;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
return false;
} else {
RGB[2] = 0;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
}
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
if (debug) {
Serial.print(F("\tHumidity: "));
Serial.print(h);
Serial.println(F(" rH"));
Serial.print(F("\tTemperature: "));
Serial.print(t);
Serial.println(F(" *C"));
Serial.print(F("\tHeat index: "));
Serial.print(hic);
Serial.println(F(" *C"));
}
return true;
}
void Graph(){
debugMillis(F("Graph()"));
Blynk.virtualWrite(V21, temperature);
}
void CHECK(){
debugMillis(F("CHECK()"));
long secondsToday = hour()*3600L + minute()*60L + second();
boolean temp = false;
for (byte i = 0; i < 6; i++){
if ((secondsToday > myTimers[i].startTimer) && (secondsToday < myTimers[i].stopTimer) && (myTimers[i].weekdays[timeDays2blynkDays(weekday())])) temp = temp | true;
}
// power = false;
humidity = 0;
heatindex = 0;
float tmean = 0;
byte index = 0;
for (byte i = 0; i < 6; i++){
if (enableArray[i]){
if (temperatureMode) {
tmean = tmean + temperatureArray[i];
if (temperatureArray[i] > 0) index++;
} else {
tmean = tmean + heatindexArray[i];
if (heatindexArray[i] > 0) index++;
}
humidity = humidity + humidityArray[i];
}
}
tmean = tmean / index;
temperature = tmean;
humidity = humidity / index;
if (!blynkConnected) {
humidity = dht.readHumidity();
temperature = dht.readTemperature();
if (!temperatureMode) {
temperature = dht.computeHeatIndex(temperature, humidity, false);
}
tmean = temperature;
}
Blynk.virtualWrite(V8, temperature);
fourLCDString[2] = "T:" + String(temperature,1)+ "°C";
fourLCDString[3] = "H:" + String(humidity,1)+ "%";
simpleLCDrefresh();
if (temp) {
if (tmean <= tmin) power = true;
if ((tmean > tmin) && (tmean < tmax)) power = true;
if (tmean > tmax) power = false;
} else {
if (tmean <= tmin) power = true;
if (tmean > tmin) power = false;
}
if (automatic) {
if (power != power_lastState) {
if (power) {
Blynk.virtualWrite(V2, HIGH);
fourLCDString[1] = "ACCESO";
simpleLCDrefresh();
Serial.println("\tAcceso");
digitalWrite(relayPIN, HIGH);
power_lastState = true;
} else {
Blynk.virtualWrite(V2, LOW);
fourLCDString[1] = "SPENTO";
simpleLCDrefresh();
Serial.println("\tSpento");
digitalWrite(relayPIN, LOW);
power_lastState = false;
}
}
}
}
void HEARTHBEAT() {
debugMillis(F("HEARTHBEAT()"));
readDHT(true);
}
void BLYNK_CHECK_CONN() {
debugMillis(F("BLYNK_CHECK_CONN()"));
if (Blynk.connected()) {
blynkConnected = true;
digitalWrite(onBoardLED, LOW);
RGB[0] = 0;
RGB[1] = 64;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
} else {
debugMillis(F("Blynk disconnected!"));
if (blynkConnected) {
if (!automatic) {
debugMillis(F("Automatic mode ON upon Blynk disconnection."));
automatic = true;
}
}
blynkConnected = false;
digitalWrite(onBoardLED, HIGH);
RGB[0] = 64;
RGB[1] = 0;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
}
}
BLYNK_CONNECTED(){
debugMillis(F("BLYNK_CONNECTED()"));
blynkConnected = true;
Blynk.syncVirtual(V0); // RTC
myTimer.setTimeout(10000, BLYNK_CONNECTED_DELAYED);
LCD.clear();
}
void BLYNK_CONNECTED_DELAYED(){
debugMillis(F("BLYNK_CONNECTED_DELAYED()"));
Blynk.syncAll();
Serial.print(now());
myTimer.setInterval(10000, BLYNK_CHECK_CONN);
myTimer.setInterval(10000, HEARTHBEAT);
myTimer.setInterval(3000, CHECK);
myTimer.setInterval(600000, Graph);
}
BLYNK_WRITE(V1){ // Modo: Aut./Man.
debugMillis(F("BLYNK_WRITE(V1)"));
int buttonState = param.asInt();
if (buttonState == 1) {
automatic = true;
fourLCDString[0] = "AUTOMAT.";
simpleLCDrefresh();
Serial.println("\tAutomatico");
RGB[2] = 0;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
} else {
automatic = false;
fourLCDString[0] = "MANUALE";
simpleLCDrefresh();
RGB[2] = 64;
pixels.setPixelColor(0, pixels.Color(RGB[0],RGB[1],RGB[2]));
pixels.show();
Serial.println("\tManuale");
}
}
BLYNK_WRITE(V2){ // ON / OFF
debugMillis(F("BLYNK_WRITE(V2)"));
int buttonState = param.asInt();
if (buttonState == 1) {
power = true;
power_lastState = true;
fourLCDString[1] = "ACCESO";
simpleLCDrefresh();
Serial.println("\tAcceso");
digitalWrite(relayPIN, HIGH);
} else {
power = false;
power_lastState = false;
fourLCDString[1] = "SPENTO";
simpleLCDrefresh();
Serial.println("\tSpento");
digitalWrite(relayPIN, LOW);
}
}
BLYNK_WRITE(V3){ // Timer 1
debugMillis(F("BLYNK_WRITE(V3)"));
long temp;
TimeInputParam t(param);
if (t.hasStartTime()) {
Serial.println(String(F("\tStart: ")) +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
temp = t.getStartHour()*3600L + t.getStartMinute()*60L + t.getStartSecond();
} else if (t.isStartSunrise()) {
Serial.println(F("\tStart at Sunrise"));
} else if (t.isStartSunset()) {
Serial.println(F("\tStart at sSunset"));
} else {
// Do nothing
}
myTimers[0].startTimer = temp;
if (t.hasStopTime()) {
Serial.println(String(F("\tStop: ")) +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
temp = t.getStopHour()*3600L + t.getStopMinute()*60L + t.getStopSecond();
} else if (t.isStopSunrise()) {
Serial.println(F("\tStop at Sunrise"));
} else if (t.isStopSunset()) {
Serial.println(F("\tStop at Sunset"));
} else {
// Do nothing: no stop time was set
}
myTimers[0].stopTimer = temp;
Serial.println(String(F("\tTime zone: ")) + t.getTZ());
Serial.println(String(F("\tTime zone offset: ")) + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
myTimers[0].weekdays[i] = false;
if (t.isWeekdaySelected(i)) {
Serial.println(String(F("\tDay ")) + i + F(" is selected"));
myTimers[0].weekdays[i] = true;
}
}
}
BLYNK_WRITE(V4){ // Timer 2
debugMillis(F("BLYNK_WRITE(V4)"));
long temp;
TimeInputParam t(param);
if (t.hasStartTime()) {
Serial.println(String(F("\tStart: ")) +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
temp = t.getStartHour()*3600L + t.getStartMinute()*60L + t.getStartSecond();
} else if (t.isStartSunrise()) {
Serial.println(F("\tStart at Sunrise"));
} else if (t.isStartSunset()) {
Serial.println(F("\tStart at sSunset"));
} else {
// Do nothing
}
myTimers[1].startTimer = temp;
if (t.hasStopTime()) {
Serial.println(String(F("\tStop: ")) +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
temp = t.getStopHour()*3600L + t.getStopMinute()*60L + t.getStopSecond();
} else if (t.isStopSunrise()) {
Serial.println(F("\tStop at Sunrise"));
} else if (t.isStopSunset()) {
Serial.println(F("\tStop at Sunset"));
} else {
// Do nothing: no stop time was set
}
myTimers[1].stopTimer = temp;
Serial.println(String(F("\tTime zone: ")) + t.getTZ());
Serial.println(String(F("\tTime zone offset: ")) + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
myTimers[1].weekdays[i] = false;
if (t.isWeekdaySelected(i)) {
Serial.println(String(F("\tDay ")) + i + F(" is selected"));
myTimers[1].weekdays[i] = true;
}
}
}
BLYNK_WRITE(V5){ // Timer 3
debugMillis(F("BLYNK_WRITE(V5)"));
long temp;
TimeInputParam t(param);
if (t.hasStartTime()) {
Serial.println(String(F("\tStart: ")) +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
temp = t.getStartHour()*3600L + t.getStartMinute()*60L + t.getStartSecond();
} else if (t.isStartSunrise()) {
Serial.println(F("\tStart at Sunrise"));
} else if (t.isStartSunset()) {
Serial.println(F("\tStart at sSunset"));
} else {
// Do nothing
}
myTimers[2].startTimer = temp;
if (t.hasStopTime()) {
Serial.println(String(F("\tStop: ")) +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
temp = t.getStopHour()*3600L + t.getStopMinute()*60L + t.getStopSecond();
} else if (t.isStopSunrise()) {
Serial.println(F("\tStop at Sunrise"));
} else if (t.isStopSunset()) {
Serial.println(F("\tStop at Sunset"));
} else {
// Do nothing: no stop time was set
}
myTimers[2].stopTimer = temp;
Serial.println(String(F("\tTime zone: ")) + t.getTZ());
Serial.println(String(F("\tTime zone offset: ")) + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
myTimers[2].weekdays[i] = false;
if (t.isWeekdaySelected(i)) {
Serial.println(String(F("\tDay ")) + i + F(" is selected"));
myTimers[2].weekdays[i] = true;
}
}
}
BLYNK_WRITE(V6){ // Timer 4
debugMillis(F("BLYNK_WRITE(V6)"));
long temp;
TimeInputParam t(param);
if (t.hasStartTime()) {
Serial.println(String(F("\tStart: ")) +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
temp = t.getStartHour()*3600L + t.getStartMinute()*60L + t.getStartSecond();
} else if (t.isStartSunrise()) {
Serial.println(F("\tStart at Sunrise"));
} else if (t.isStartSunset()) {
Serial.println(F("\tStart at sSunset"));
} else {
// Do nothing
}
myTimers[3].startTimer = temp;
if (t.hasStopTime()) {
Serial.println(String(F("\tStop: ")) +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
temp = t.getStopHour()*3600L + t.getStopMinute()*60L + t.getStopSecond();
} else if (t.isStopSunrise()) {
Serial.println(F("\tStop at Sunrise"));
} else if (t.isStopSunset()) {
Serial.println(F("\tStop at Sunset"));
} else {
// Do nothing: no stop time was set
}
myTimers[3].stopTimer = temp;
Serial.println(String(F("\tTime zone: ")) + t.getTZ());
Serial.println(String(F("\tTime zone offset: ")) + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
myTimers[3].weekdays[i] = false;
if (t.isWeekdaySelected(i)) {
Serial.println(String(F("\tDay ")) + i + F(" is selected"));
myTimers[3].weekdays[i] = true;
}
}
}
BLYNK_WRITE(V7){ // Timer 5
debugMillis(F("BLYNK_WRITE(V7)"));
long temp;
TimeInputParam t(param);
if (t.hasStartTime()) {
Serial.println(String(F("\tStart: ")) +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
temp = t.getStartHour()*3600L + t.getStartMinute()*60L + t.getStartSecond();
} else if (t.isStartSunrise()) {
Serial.println(F("\tStart at Sunrise"));
} else if (t.isStartSunset()) {
Serial.println(F("\tStart at sSunset"));
} else {
// Do nothing
}
myTimers[4].startTimer = temp;
if (t.hasStopTime()) {
Serial.println(String(F("\tStop: ")) +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
temp = t.getStopHour()*3600L + t.getStopMinute()*60L + t.getStopSecond();
} else if (t.isStopSunrise()) {
Serial.println(F("\tStop at Sunrise"));
} else if (t.isStopSunset()) {
Serial.println(F("\tStop at Sunset"));
} else {
// Do nothing: no stop time was set
}
myTimers[4].stopTimer = temp;
Serial.println(String(F("\tTime zone: ")) + t.getTZ());
Serial.println(String(F("\tTime zone offset: ")) + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
myTimers[4].weekdays[i] = false;
if (t.isWeekdaySelected(i)) {
Serial.println(String(F("\tDay ")) + i + F(" is selected"));
myTimers[4].weekdays[i] = true;
}
}
}
BLYNK_WRITE(V9){ // Timer 6
debugMillis(F("BLYNK_WRITE(V9)"));
long temp;
TimeInputParam t(param);
if (t.hasStartTime()) {
Serial.println(String(F("\tStart: ")) +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
temp = t.getStartHour()*3600L + t.getStartMinute()*60L + t.getStartSecond();
} else if (t.isStartSunrise()) {
Serial.println(F("\tStart at Sunrise"));
} else if (t.isStartSunset()) {
Serial.println(F("\tStart at sSunset"));
} else {
// Do nothing
}
myTimers[5].startTimer = temp;
if (t.hasStopTime()) {
Serial.println(String(F("\tStop: ")) +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
temp = t.getStopHour()*3600L + t.getStopMinute()*60L + t.getStopSecond();
} else if (t.isStopSunrise()) {
Serial.println(F("\tStop at Sunrise"));
} else if (t.isStopSunset()) {
Serial.println(F("\tStop at Sunset"));
} else {
// Do nothing: no stop time was set
}
myTimers[5].stopTimer = temp;
Serial.println(String(F("\tTime zone: ")) + t.getTZ());
Serial.println(String(F("\tTime zone offset: ")) + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
myTimers[5].weekdays[i] = false;
if (t.isWeekdaySelected(i)) {
Serial.println(String(F("\tDay ")) + i + F(" is selected"));
myTimers[5].weekdays[i] = true;
}
}
}
BLYNK_WRITE(V10){ // Stanza 1: Temperatura
debugMillis(F("BLYNK_WRITE(V10)"));
temperatureArray[0] = param[0].asFloat();
}
BLYNK_WRITE(V11){ // Stanza 1: Umidità
debugMillis(F("BLYNK_WRITE(V11)"));
humidityArray[0] = param[0].asFloat();
}
BLYNK_WRITE(V12){ // Stanza 1: Calore percepito
debugMillis(F("BLYNK_WRITE(V12)"));
heatindexArray[0] = param[0].asFloat();
}
BLYNK_WRITE(V15){ // Stanza 1: Abilitazione
debugMillis(F("BLYNK_WRITE(V15)"));
if (param[0].asInt() == 1) {
enableArray[0] = true;
Serial.println("\tAbilitata");
} else {
enableArray[0] = false;
Serial.println("\tDisabilitata");
}
}
BLYNK_WRITE(V16){ // Stanza 2: Abilitazione
debugMillis(F("BLYNK_WRITE(V16)"));
if (param[0].asInt() == 1) {
enableArray[1] = true;
Serial.println("\tAbilitata");
} else {
enableArray[1] = false;
Serial.println("\tDisabilitata");
}
}
BLYNK_WRITE(V17){ // Stanza 3: Abilitazione
debugMillis(F("BLYNK_WRITE(V17)"));
if (param[0].asInt() == 1) {
enableArray[2] = true;
Serial.println("\tAbilitata");
} else {
enableArray[2] = false;
Serial.println("\tDisabilitata");
}
}
BLYNK_WRITE(V18){ // Stanza 4: Abilitazione
debugMillis(F("BLYNK_WRITE(V18)"));
if (param[0].asInt() == 1) {
enableArray[3] = true;
Serial.println("\tAbilitata");
} else {
enableArray[3] = false;
Serial.println("\tDisabilitata");
}
}
BLYNK_WRITE(V19){ // Stanza 5: Abilitazione
debugMillis(F("BLYNK_WRITE(V19)"));
if (param[0].asInt() == 1) {
enableArray[4] = true;
Serial.println("\tAbilitata");
} else {
enableArray[4] = false;
Serial.println("\tDisabilitata");
}
}
BLYNK_WRITE(V20){ // Stanza 6: Abilitazione
debugMillis(F("BLYNK_WRITE(V20)"));
if (param[0].asInt() == 1) {
enableArray[5] = true;
Serial.println("\tAbilitata");
} else {
enableArray[5] = false;
Serial.println("\tDisabilitata");
}
}
BLYNK_WRITE(V22){ // Temperatura Reale o Percepita
debugMillis(F("BLYNK_WRITE(V22)"));
if (param[0].asInt() == 1) {
temperatureMode = true;
Serial.println("\tTemperatura reale");
} else {
temperatureMode = false;
Serial.println("\tTemperatura percepita");
}
}
BLYNK_WRITE(V30){ // T.Min
debugMillis(F("BLYNK_WRITE(V30)"));
tmin = param[0].asFloat();
Serial.println("\tT.MIN: " + String(tmin) + "°C");
Blynk.virtualWrite(V13, tmin);
}
BLYNK_WRITE(V31){ // T.Max
debugMillis(F("BLYNK_WRITE(V31)"));
tmax = param[0].asFloat();
Serial.println("\tT.MAX: " + String(tmax) + "°C");
Blynk.virtualWrite(V14, tmax);
}
BLYNK_WRITE(V33){ // Stanza 2: Temperatura
debugMillis(F("BLYNK_WRITE(V33)"));
temperatureArray[1] = param[0].asFloat();
}
BLYNK_WRITE(V34){ // Stanza 2: Umidità
debugMillis(F("BLYNK_WRITE(V34)"));
humidityArray[1] = param[0].asFloat();
}
BLYNK_WRITE(V35){ // Stanza 2: Calore percepito
debugMillis(F("BLYNK_WRITE(V35)"));
heatindexArray[1] = param[0].asFloat();
}
BLYNK_WRITE(V36){ // Stanza 3: Temperatura
debugMillis(F("BLYNK_WRITE(V36)"));
temperatureArray[2] = param[0].asFloat();
}
BLYNK_WRITE(V37){ // Stanza 3: Umidità
debugMillis(F("BLYNK_WRITE(V37)"));
humidityArray[2] = param[0].asFloat();
}
BLYNK_WRITE(V38){ // Stanza 3: Calore percepito
debugMillis(F("BLYNK_WRITE(V38)"));
heatindexArray[2] = param[0].asFloat();
}
BLYNK_WRITE(V39){ // Stanza 4: Temperatura
debugMillis(F("BLYNK_WRITE(V39)"));
temperatureArray[3] = param[0].asFloat();
}
BLYNK_WRITE(V40){ // Stanza 4: Umidità
debugMillis(F("BLYNK_WRITE(V40)"));
humidityArray[3] = param[0].asFloat();
}
BLYNK_WRITE(V41){ // Stanza 4: Calore percepito
debugMillis(F("BLYNK_WRITE(V41)"));
heatindexArray[3] = param[0].asFloat();
}
void loop() {
Blynk.run();
myTimer.run();
if (blynkConnected) {
} else {
}
}