Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // W gruncie rzeczy to zostało tylko aby program się wyłączał gdy temperatura osiągnie wartość 100
- #include <DHT.h>
- #define DHT11_PIN A0
- DHT dht;
- String a;
- int temperatura;
- void setup()
- {
- Serial.begin(9600);
- pinMode(7, OUTPUT);
- dht.setup(DHT11_PIN);
- }
- ////////////////////////////////////////////////////////////////////////////
- void loop()
- {
- //Pobranie informacji o temperaturze
- int temperatura = dht.getTemperature();
- Serial.print(temperatura);
- Serial.println("*C");
- while (temperatura<=24)
- {
- Serial.println(" W WHILE");
- int temperatura = dht.getTemperature();
- Serial.print(temperatura);
- while (Serial.available())
- {
- a=Serial.readString();
- Serial.println(a);
- if (a=="ON")
- {
- digitalWrite(7,HIGH);
- Serial.println("WŁĄCZONO OGRZEWANIE");
- }
- if (a=="OFF")
- {
- digitalWrite(7,LOW);
- Serial.println("OGRZEWANIE WYŁĄCZONO");
- }
- }
- delay(1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement