hi everyone, I am pretty new in Arduino so I need your help.
I’m using Arduino Uno R3 with DHT11, YL69, and 4 channel relay.
when Relay start working, I still receive data from the board but, when It’s turn off again, serial monitor stop working but
the circuit still working.
I am using 5v/2A adaptor for relay and using USB power for Arduino.
here is my code :
#include <dht.h>
dht DHT;
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT);
}
void loop()
{
//Air Sensor
int chk = DHT.read11(7);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
//Soil Sensor
Serial.print("Moisture Sensor Value:");
Serial.println(analogRead(0));
int x = analogRead(0);
//Relay and Pomp Control
if ( x < 500)
digitalWrite(8, LOW);
else
digitalWrite(8, HIGH);
delay(2000);
}
help me I really need your help.