Hello!
I'm just trying to get a LED to turn on when the soil moisture sensor says that it is dry. That's all.
I know my wiring is correct, because if I tell the LED to turn to HIGH when the soil sensor is HIGH, then it doesn't turn off. Any help is greatly appreciated.
Here is my code
int led = 12;
int moistureSensor = A0;
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(moistureSensor, INPUT);
}
void loop()
{
int sensorValue = analogRead(moistureSensor);
if (sensorValue, HIGH)
{
digitalWrite(led, LOW);
}
else if (sensorValue, LOW)
{
digitalWrite(led, HIGH);
}
delay(1000);
}