I'm very new to the Arduino game I wanted to make a small auto watering system for my plants. I bought these items
- 5V 1 CHANNEL RELAY MODULE FOR ARDUINO PIC AVR DSP ARMB
- 9 VOLT BATTERY SNAP CONNECTOR B
- ARDUINO UNO R3
- CAMELION 9V BATTERY SUPER HEAVY DUTY
- PIN TO HOLE DUPONT 40 PIN 30CM ARDUINO JUMPER WIRE 12 INCH
- SOIL MOISTURE METER FOR ARDUINO.
I followed a video on youtube I attached the guys circuit diagram as well. After following instructions my pump wont turn on I also programmed it as well. Please help if anyone can show me how to rewire the device and codes or if I'm doing something wrong. Please help.
int Relay = 13;
int sensor = 8;
int val;
void setup() {
pinMode(13,OUTPUT); //Set pin 13 as OUTPUT pin, to send signal to relay
pinMode(8,INPUT); //Set pin 8 as input pin, to receive data from Soil moisture sensor.
}
void loop() {
val = digitalRead(8);
if(val == LOW)
{
digitalWrite(13,LOW); //if soil moisture sensor provides LOW value send LOW value to relay
}
else
{
digitalWrite(13,HIGH); //if soil moisture sensor provides HIGH value send HIGH value to relay
}
delay(400);
}