Hi, question for my very first Arduino project. I'm trying to build a humidity controller for growing mushrooms. The basic idea is to turn on an atomization disc until the humidity sensor reads 90% and then shut off. I found one online and bought the parts, but when I went to order the humidity sensor (DHT11), the part offered instead was an AHT10, which apparently is more accurate. However, it has a different pin configuration, which throws off the schematic, and the code must be different as well.
Unfortunately, I really don't understand what I'm doing well enough to make the adjustments. I'll include the schematic and code. I'm hoping to learn as I go, so if you could explain what the changes are and what they do, I'd really appreciate it.
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);//Set the device name: I2C-SSD1306-128*64 (OLED)
#include "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT11
#define jiashi 2
#define button 12
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
pinMode(jiashi,OUTPUT);
pinMode(button,INPUT);
dht.begin();
}
void loop() {
float Humid = dht.readHumidity();
float Temp = dht.readTemperature();
Serial.print("Temp");
Serial.print(Temp);
delay(1000);
Serial.print("Humid");
Serial.print(Humid);
delay(1000);
u8g.firstPage();
do
{
u8g.setFont(u8g_font_gdr14r);
u8g.setPrintPos(25,18);
u8g.print("DKARDU");
u8g.setFont(u8g_font_9x18);
u8g.setPrintPos(1,40);
u8g.print("Temp: ");
u8g.print(Temp);
u8g.print("'C");
u8g.setPrintPos(1,60);
u8g.print("Humid: ");
u8g.print(Humid);
u8g.print("%");
}while(u8g.nextPage());
if(Humid<80){
digitalWrite(jiashi,LOW);
}else
{
digitalWrite(jiashi,HIGH);
}
}
