Hi, im new in coding and im trying for days now to solve this problem. I want a Arduino Uno with the DHT22 Temp. and Hum. Sensor and a OLED 128x64 Display. The Arduino is already put together and the code is as good as finished. Only one Problem:
#include <Adafruit_SSD1306.h> //Bibliothek 1
#include <Adafruit_GFX.h> //Bibliothek 2
#include <dht.h> //Bibliothek 3
#define dataPin 2. //Festlegung für Daten Pin
dht DHT;
#define OLED_RESET -1 //Reset Knopf Funktion
#define SCREEN_WIDTH 128 //OLED Display Höhe
#define SCREEN_HEIGHT 64 //OLED Display Breite
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, OLED_RESET);
void setup() { //Verzögerung Abbildung OLED
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //Beginn Abbildung
delay(1000); //Delay 1 sek.
display.clearDisplay();
display.setTextSize(1); //Textgröße 1
display.setTextColor(WHITE); //Textfarbe Weiß
display.setCursor(0, 0); //Display 0 Punkt
display.print(“Temperature/Humidity”); //Hochfahr Sequenz Text
display.display();
Serial.begin(9600);
}
void loop() {
int readData = DHT.read22(dataPin); //Daten Pin für Info Übermittlung
float t = DHT.temperature; //Wert für Temperatur
float h = DHT.humidity; //Wert für Luftfeuchtigkeit
// Werte Print auf OLED-Display
Serial.print("Temperature = “);
Serial.print(t);
Serial.print(” *C “);
Serial.print(” Humidity = “);
Serial.print(h);
Serial.println(” % ");
delay(2000); // 2 Sekunden Verzögerung bis Neuanfang Loop
}
The error is:
Arduino: 1.8.13 Hourly Build 2020/06/16 12:33 (Windows 10), Board: “Arduino Uno”
sketch_Temp._FERTIG:9:1: error: ‘dht’ does not name a type
dht DHT;
^~~
C:\Users\Alexo\Documents\Arduino\radix_sketch_Temp._FERTIG\sketch_Temp._FERTIG.ino: In function ‘void loop()’:
sketch_Temp._FERTIG:28:21: error: expected primary-expression before ‘.’ token
int readData = DHT.read22(dataPin); //Daten Pin für Info Übermittlung
^
sketch_Temp._FERTIG:29:16: error: expected primary-expression before ‘.’ token
float t = DHT.temperature; //Wert für Temperatur
^
sketch_Temp._FERTIG:30:16: error: expected primary-expression before ‘.’ token
float h = DHT.humidity; //Wert für Luftfeuchtigkeit
^
Mehrere Bibliotheken wurden für “Adafruit_SSD1306.h” gefunden
Benutzt: C:\Users\Alexo\Documents\Arduino\libraries\Adafruit_SSD1306
Nicht benutzt: C:\Users\Alexo\Documents\Arduino\libraries\Adafruit_SSD1306_Wemos_Mini_OLED
exit status 1
‘dht’ does not name a type
Can somebody help? xD
ps… Sorry for the german comments on the side of the code. Thx for helping