/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
****/
```cpp
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#define DHTTYPE DHT11 // DHT 11
#include <DHTesp.h>
//#include <DHT.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxx";
#define TempHumPin D4
DHTesp dht;
//DHT dht(TempHumPin, DHTTYPE);
BlynkTimer timer;
float AnlogVal;
boolean debug=false;
int HomePos = 93,dlay= 10000, Speed=10; // homepos was 92
int startHr=5,stopHr=0,startMin=0, stopMin=0,SpdModifier=0, EndDelay=0,i;
String StartTime="5:00",EndTime="",LightCycle="24-0";
//*********************************************************************************************
void setup() {
Serial.begin(115200);
pinMode(TempHumPin, INPUT );
// dht.setup(12, DHTesp::DHT11); // Connect DHT sensor to GPIO 12 - D6
// dht.setup(16, DHTesp::DHT11); // Connect DHT sensor to GPIO 16 - D2
//dht.setup(0, DHTesp::DHT11); // Connect DHT sensor to GPIO 0 - D8
dht.setup(4, DHTesp::DHT11); // Connect DHT sensor to GPIO 4 - D4
//dht.begin();
Blynk.begin(auth, ssid, pass);
delay(1000);
timer.setInterval(2000L, GetTempHumidity);
} // end setup
//********************************************************************************
void loop() {
// put your main code here, to run repeatedly:
// only need 1 pin, leave 2 for future
Blynk.run();
timer.run();
//GetTempHumidity();
//delay(1000);
} // end loop
//***************************************************************************************
void GetTempHumidity()
{
delay(dht.getMinimumSamplingPeriod());
float humidity = dht.getHumidity();
float temperature = dht.getTemperature();
Serial.print(dht.getStatusString());
Serial.print("\t");
Serial.print(humidity, 1);
Serial.print("\t\t");
Serial.print(temperature, 1);
Serial.print("\t\t");
Serial.print(dht.toFahrenheit(temperature), 1);
Serial.print("\t\t");
Serial.print(dht.computeHeatIndex(temperature, humidity, false), 1);
Serial.print("\t\t");
Serial.println(dht.computeHeatIndex(dht.toFahrenheit(temperature), humidity, true), 1);
Blynk.virtualWrite(V5, humidity);
Blynk.virtualWrite(V6, temperature);
} // end GetTempHumidity
Not sure, do I describe the problem here, after the code?
Board: Arduino D1 wifi with esp8266 0nboard.
Selected board in Arduino IDE: Wemos D1 R1.
Arduino IDE version: 1.8.5
When I comment Blynk.begin and Blynk.run out, it works fine, even with relay connected to D11.
Blynk feedback and version:
[8479] Connected to WiFi
[8479] IP: 192.168.0.102
[8479]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.6.1 on ESP8266
[8485] Connecting to blynk-cloud.com:80
[8727] <[1D|00|01|00] 3d170bc1986143a69a5bd844b005810b
[8956] >[00|00|01|00|C8]
[8956] Ready (ping: 228ms).
[8957] Free RAM: 48536
[8957] >[14|00|01|00|08]
[8957] >pm[00]6[00]out
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
Blynk server.
Android 8 phone.
Have searched and read up on the watchdog timer, seems delays in the code can cause it, although some say no, delay() incorporates yield() so it should’nt cause a problem.
Do not know if this is true.
Could’nt find what the (1,6) means.
I have tried it without the humidity as well, thought maybe the delay incorporated by the humidity library caused it, but it did not matter.
Should’nt as this library for humidity is for the esp8266
Would appreciate any help.
Thanks.
Peet