aboutsummaryrefslogtreecommitdiff
path: root/assignments/read-temperature/solution/read-temperature/read-temperature.ino
blob: b261dc51b82a67098474aa66e2d6ed3acf92f9b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <DHT.h>
#include <DHT_U.h>

const auto DHTPIN = D1;
const auto DHTTYPE = DHT22;

DHT_Unified dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(115200);
  pinMode(D2, INPUT);
  pinMode(D0, OUTPUT);
}

void loop() {
  if (digitalRead(D2) == HIGH) {
    Serial.println("HIGH");
  } else {
    Serial.println("LOW");
  }
  digitalWrite(D0, digitalRead(D2));
  delay(100);
}