Created
April 11, 2023 12:10
-
-
Save jakiki6/d1777195da8c5bf3ade152107bbf600d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <DHT.h> | |
#include <Servo.h> | |
#include <LiquidCrystal.h> | |
// rs, rw, enable, d4, d5, d6, d7 | |
LiquidCrystal lcd(5, 6, 7, 8, 9, 10, 11); | |
Servo servo; | |
DHT dht(4, DHT11); | |
void setup() { | |
dht.begin(); | |
servo.attach(3); | |
lcd.begin(16, 2); | |
lcd.setCursor(0, 0); | |
lcd.print("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); | |
lcd.clear(); | |
lcd.setCursor(0, 0); | |
} | |
void loop() { | |
float hum = dht.readHumidity(); | |
if (!isnan(hum)) servo.write(hum / 100.0 * 180.0); | |
lcd.setCursor(0, 0); | |
lcd.print(String(hum).c_str()); | |
lcd.print(" %"); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment