motoru 5. pine bağlayamazsınız hocam, 5'de display bağlı. Motorun sağa dönüş pinini 6. pine, sola dönüş pinini 7. pine bağlanmş varsayarak
buyrun;
// include the library code:
#include <LiquidCrystal.h>
#include "DHT.h"
// set the DHT Pin
#define DHTPIN 8
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
dht.begin();
lcd.print("Sıcaklık: Nem:");
pinMode (6, OUTPUT); //6. pinde motorun sağa dönüş pini
pinMode (7, OUTPUT); //7. pinde motorun sola dönüş pini
}
void loop() {
delay(500);
lcd.setCursor(0, 1);
float h = dht.readHumidity();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(f)) {
lcd.print("ERROR");
return;
}
lcd.print(f);
lcd.setCursor(7,1);
lcd.print(h);
if (f > 25) {
digitalWrite(6, HIGH); //eğer sıcaklık 25 f'in üstündeyse motor sağa doğru döner
digitalWrite(7, LOW); // motorun sola dönüşü kapalıdır.
}
else {
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
}