Arduino Server temp controller

on redled pin 9 will be relay

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <DHT11.h>
#define DHT, TYPE DHT11
#define DHT_PIN 2

WidgetLED redLed1(V5);
WidgetLED greenLed1(V6);
dht DHT11;

char auth[] = “token”;
int redLed = 9;
int greenLed = 8;
float time;

void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
Blynk.virtualWrite(V0, millis() / 1000);
Serial.begin(9600);
Serial.println(“DHT test”);
dht.begin();
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
}
void blinkLedWidget()
{
if (redLed1.getValue()) {
redLed1.off();
Serial.println(“LED on V5: off”);
} else {
redLed1.on();
Serial.println(“LED on V5: on”);
}
if (greenLed1.getValue()) {
greenLed1.off();
Serial.println(“LED on V6: off”);
} else {
greenLed1.on();
Serial.println(“LED on V6: on”);
}
}
void loop()
{
// 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();

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println(“Failed to read from DHT”);
} else {
Serial.print(“Time: “);
time = millis()/1000;
Serial.print(time);
Serial.print(” secs\t”);
Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print(“Temperature: “);
Serial.print(t);
Serial.println(” *C”);

int chk = DHT.read11(DHTPIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature,V1);
Serial.print("Humidity = ");
Serial.println(DHT.humidity,V2);   

timer.run();
Blynk.virtualWrite( DHT.temperature,V1);
Blynk.virtualWrite( DHT.humidity,V2);

// 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();
}
// Turn red LED on and green LED off if the temperature is 25 degrees or more.
// Turn green LED on and red LED off if the temperature is less than 25 degrees.
if (t >= 25) {
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
}
else {
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
}
// Wait 5 seconds before starting the next reading.
delay(5000);
Blynk.run();
}

@muttley687

If you need any help with your project:

  1. Say what results you are getting and what you expect.
  2. Describe all your hardware and software.
  3. Provide a formatted sketch.
  4. Ensure you just have 2 lines of code in loop() for ESP and Blynk sketches.

sorry about that i am trying to make a auto temp fan control when get to 25 deg it changed state that works but the DHT is playing up. thanks

Arduino_Ethernet222.ino:6:14: warning: missing whitespace after the macro name [enabled by default]
Arduino_Ethernet222:11: error: ‘dht’ does not name a type
Arduino_Ethernet222.ino: In function ‘void setup()’:
Arduino_Ethernet222:25: error: ‘dht’ was not declared in this scope
Arduino_Ethernet222.ino: In function ‘void loop()’:
Arduino_Ethernet222:50: error: ‘dht’ was not declared in this scope
Arduino_Ethernet222:68: error: ‘DHT’ was not declared in this scope
Arduino_Ethernet222:68: error: ‘DHTPIN’ was not declared in this scope
Arduino_Ethernet222:74: error: ‘timer’ was not declared in this scope
Multiple libraries were found for “DHT11.h”