Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
535 B
2
Indexable
Never
#include "DHT.h"
#include <WiFi.h>

#define DHTPIN 4

#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  dht.begin();
  WiFi.mode(WIFI_MODE_STA);
  Serial.println(WiFi.macAddress());
}

void loop() {
  delay(2000);
  double h = dht.readHumidity();
  double t = dht.readTemperature();


   Serial.print(F("Humidity: "));
  Serial.print(h);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
}