Hello Everyone,
I am new to programming and trying to learn the ropes. What I am trying to accomplish is, control a humidifier with a relay. I based my code off of a video. What I want the code to do is read the value coming from the DHT11 sensor and and turn the relay on if it is high than a set value. So I wrote/borrowed the following code. I get the following error code - Arduino: 1.6.1 (Mac OS X), Board: "Arduino Uno"
(code tags added by Moderator - please use them in your future posts)
DHT11.ino: In function 'void loop()':
DHT11.ino:62:1: error: expected '}' at end of input
Error compiling. "
//
// FILE: dht11_test.ino
// AUTHOR: Adam Zabielski
// VERSION: 1.0
// PURPOSE: Humidifier Control Module
//
#include <dht.h>
dht DHT;
#define DHT11_PIN 2
int Humidifier = 4;
//Onborad led
int led = 13;
int i = 0;
void setup()
{
Serial.begin(115200);
Serial.println("DHT TEST PROGRAM ");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT_LIB_VERSION);
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
pinMode(Humidifier,OUTPUT);
pinMode(led,OUTPUT);
}
void loop()
{
// READ DATA
Serial.print("DHT11, \t");
int chk = DHT.read11(DHT11_PIN);
// DISPLAY DATA
Serial.print(DHT.humidity, 1);
Serial.print(",\t");
Serial.println(DHT.temperature, 1);
//Relay Control
if (DHT.humidity<55) {
digitalWrite(Humidifier,LOW);
} else { digitalWrite(Humidifier,HIGH);
}
// Deley and LED flashing
i=0;
while (i<10) {
digitalWrite(led,HIGH);
delay(1000);
digitalWrite(led,LOW);
delay(1000);
i++;
}
// End of code
Thanks for taking a look.