Expected primary-expression before '.' token

Hello,
I am currently working on a script to steer a relay based on the temperatur and humidity in a room. For this I am using a DHT11. I already have a code which could work in my opinion but check it it always shows the same mistake (expected primary-expression before '.' token). I realy hope someone could help me.

#include "DHT.h"
 #define DHTTYPE DHT11
 #define DHTPIN 2
 DHT dht(DHTPIN, DHTTYPE);
void setup() {
pinMode(6, INPUT);
pinMode(12, OUTPUT);
dht.begin();
}

void loop() {
if (DHT.humidity >40){
    digitalWrite (12,HIGH);
  }else{
    digitalWrite, (12,LOW);
  }
if (DHT.temperature >30){
    digitalWrite(PIN4,HIGH);
  }else{
    digitalWrite(PIN4,LOW);
  }
}

Thank you, but now it shows a different mistake:
'class DHT' has no member named 'humidity'; did you mean 'readHumidity'?

Thank you very much, you saved me.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.