Hey together,
after finishing my project, i´ve tested the code and my ESP for one day.
After 1-2 minutes, the console send me the error “HeartBeat Timeout”…
Then it tries to reconnect constantly, but doesn´t work…
Can someone give me some tips or tell me what it is?
Thank u!
14:28:35.019 -> ⸮⸮$⸮p⸮l⸮sd⸮⸮'⸮⸮cl`;⸮oadph⸮⸮[67] Connecting to SSID
14:28:39.400 -> [4405] Connected to WiFi
14:28:39.400 -> [4406] IP: 192.168.0.62
14:28:39.400 -> [4406]
14:28:39.400 -> ___ __ __
14:28:39.400 -> / _ )/ /_ _____ / /__
14:28:39.400 -> / _ / / // / _ \/ '_/
14:28:39.400 -> /____/_/\_, /_//_/_/\_\
14:28:39.434 -> /___/ v0.6.1 on ESP8266
14:28:39.434 ->
14:28:39.434 -> [4412] Connecting to blynk-cloud.com:80
14:28:39.468 -> [4479] Ready (ping: 21ms).
14:28:41.440 -> Auto-Mode
14:31:59.576 -> Feuchte:
14:31:59.576 -> 0%Autobetrieb startet
14:31:59.746 -> 1
14:31:59.746 -> Pumpe an
14:32:38.783 -> [243777] Heartbeat timeout
14:32:43.778 -> [248761] Connecting to blynk-cloud.com:80
14:32:48.769 -> [253762] Connecting to blynk-cloud.com:80
14:32:53.794 -> [258763] Connecting to blynk-cloud.com:80
14:32:58.785 -> [263764] Connecting to blynk-cloud.com:80
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <Blynk.h>
#include <BlynkSimpleEsp8266.h>
#define DRY_SOIL 50
BlynkTimer timer;
WidgetLED LED(V5);
char auth[] = "TOKEN";
char ssid[] = "SSID";
char pass[] = "PASS";
int feuchte;
int timerNr2;
int timerNr3;
//int timerNr4;
int manBTN;
//------------------------------------------------SETUP
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Blynk.begin( auth, ssid , pass );
pinMode(5, OUTPUT);
pinMode(A0, INPUT);
timerNr2 = timer.setInterval(200000, startFeuchte);
timer.disable(timerNr2);
timerNr3 = timer.setInterval(200000, startAuto);
timer.disable(timerNr3);
//timerNr4 = timer.setTimer(6000, startPumpe, 1);
//timer.disable(timerNr4);
}
//------------------------------------------------LOOP
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
timer.run();
}
//------------------------------------------------Funktionen
void startFeuchte(){
feuchteSenden();
}
//----------------------------------------------
void startAuto(){
automatik();
}
//----------------------------------------------
/*
void startPumpe(){
pumpenStart();
}
//----------------------------------------------
*/
BLYNK_WRITE(V10){
switch (param.asInt())
{
case 1: { // Item 1
Serial.println("Auto-Mode");
timer.enable(timerNr2);
timer.enable(timerNr3);
break;
}
case 2: { // Item 2
Serial.println("Manuell-Mode");
digitalWrite(5, LOW);
timer.enable(timerNr2);
timer.disable(timerNr3);
break;
}
}
}
//----------------------------------------------
BLYNK_WRITE(V0){
manBTN=param.asInt();
if(manBTN==1){
//pumpenStart();
digitalWrite(5, HIGH);
//LED.on();
}
else{
digitalWrite(5, LOW);
//LED.off();
}
}
//----------------------------------------------
void feuchteMessen(void)
{
int i = 0;
feuchte = 0;
for (i = 0; i < 10; i++) //
{
feuchte += analogRead(A0);
delay(20);
}
feuchte = feuchte / (i);
feuchte = map(feuchte, 640, 220, 0, 100);
}
//----------------------------------------------
void feuchteSenden(){
Serial.println("Feuchte: ");
Serial.print(feuchte);
Serial.print("%");
Blynk.virtualWrite(V4, feuchte);
}
//----------------------------------------------
void automatik(){
Serial.println("Autobetrieb startet");
feuchteMessen();
Serial.println(feuchte);
if(feuchte<50){
digitalWrite(5, HIGH);
Serial.println("Pumpe an");
LED.on();
}
else{
digitalWrite(5, LOW);
Serial.println("Pumpe aus");
LED.off();
}
}
//----------------------------------------------
void pumpenStart(){
digitalWrite(5, HIGH);
//timer.enable(timerNr4);
}