I have been trying to get a simple Temperature System going using a NodeMCU (ESP8266) and DHT22 Sensor.
I can successfully get it working locally on an UNO but when I try to use it on Blynk I cant get it to work…
I have read and Read the forms and tried a dozen different scripts to no avail…
Any help would be greatly appreciated. My Script is below
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
#define DHTPIN 5
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE, 15);
char auth[] = "XXX";
SimpleTimer timer;
float humidity, temp; // Values read from sensor
void sendUptime()
{
Blynk.virtualWrite(V5, millis() / 1000);
}
BLYNK_READ(1)
{
temp = dht.readTemperature();
Blynk.virtualWrite(V13,temp);
}
BLYNK_READ(2)
{
humidity = dht.readHumidity();
Blynk.virtualWrite(V14,humidity);
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, "XXX", "XXX");
dht.begin();
timer.setInterval(1000L, sendUptime);
}
void loop()
{
Blynk.run(); // Initiates Blynk
timer.run(); // Initiates SimpleTimer
}