aboutsummaryrefslogtreecommitdiff
path: root/assignments/read-temperature/solution/read-temperature
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-05-08 10:08:32 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-05-08 10:08:32 +0200
commit5ec40ac294aa8f092b3f70dca1cb6d103699a995 (patch)
tree36c88ba66518ba2217b8ddb1cdba80c05839a2bc /assignments/read-temperature/solution/read-temperature
parent50a4f485667699d091ef8bd3cac3a73290bf0cba (diff)
downloadiot-workshop-master.tar.gz
iot-workshop-master.tar.bz2
iot-workshop-master.tar.xz
iot-workshop-master.zip
Diffstat (limited to 'assignments/read-temperature/solution/read-temperature')
-rw-r--r--assignments/read-temperature/solution/read-temperature/read-temperature.ino10
1 files changed, 10 insertions, 0 deletions
diff --git a/assignments/read-temperature/solution/read-temperature/read-temperature.ino b/assignments/read-temperature/solution/read-temperature/read-temperature.ino
index 71e860e..b261dc5 100644
--- a/assignments/read-temperature/solution/read-temperature/read-temperature.ino
+++ b/assignments/read-temperature/solution/read-temperature/read-temperature.ino
@@ -7,8 +7,18 @@ 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);
}