Hello Everyone,
I am trying to connect all the lights in my room to Blynk. I am using a NodeMCU. I don’t have a private server and am using Blynk cloud server. I have just copied the code from the DHT example and it works fine. But when I add a BLYNK_CONNECTED() function with a Blynk.Syncall() command, the NodeMCU starts to reboot every few seconds. Also, when I try to turn on a pin through IFTTT and Webhooks, it reboots again. Please Help.
```
#define BLYNK_PRINT Serial
/*
Pins Defined on app; D2, D4, D5, D6
*/
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
char auth[] = "aG43gJ-SF*********nx-AGXal5IJw";
char ssid[] = "R******* 4";
char pass[] = "78*******";
#define DHTPIN 13 // What digital pin we're connected to D7
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
BLYNK_CONNECTED()
{
Blynk.syncAll();
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
dht.begin();
`indent preformatted text by 4 spaces`
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
```