gwareloth:
Maybe you set pin 8 as an output with pinMode, but not pin 10?Difficult to say though; you should post your code.
I think the problem is using the home power supply but anyway,
Here is my code and thanks:
int sensor_pin = A0 ;
int output_value ;
int valve_pin = 8 ;
void setup ( ) {
Serial.begin(9600);
Serial.println("Reading From the Sensor ... " );;
delay (2000);
}
void loop ( ) {
output_value = analogRead (sensor_pin);
output_value = map (output_value , 1023 , 0 , 0 , 100);
Serial.println (" Moisture = ");
Serial.println (output_value);
if (output_value < 40)
{
Serial.println (" Valve: ON ");
digitalWrite (valve_pin , LOW); //Relay operates on opposite signal
delay (1000);
}
else
{
Serial.println (" Valve: OFF ");
digitalWrite (valve_pin , HIGH); //Relay operates on opposite signal
delay (1000);
}
delay(1000);
}