cheap water level indicator

Greetings guys.

I'm trying to install a cheap water level solution for my plant project.

The wires are soldered to stainless steel nails so I don't think corrosion issues will surface.

My problem is both LEDs are lighting up :(

Please advise how to improve my setup. Many thanks in advance. :)

int waterlevel1 = 0; //water level probe for Green led
int waterlevel2 = 0; // water level probe for Red led
int threshold = 200;


#define redLED  4
#define redLEDNeg  5
#define greenLED 7
#define greenLEDNeg 6

void setup() {
  Serial.begin(9600);

  pinMode(greenLED, OUTPUT);
  pinMode(greenLEDNeg, OUTPUT);
  digitalWrite(greenLEDNeg, LOW);
  
  pinMode(redLED, OUTPUT);
  pinMode(redLEDNeg, OUTPUT);
  digitalWrite(redLEDNeg, LOW);
}


void loop() {
  waterlevel1 = analogRead(A0);
  Serial.print("Water level Green:");
  Serial.println(waterlevel1);
  delay(1000);
  waterlevel2 = analogRead(A1);
  Serial.print("Water level Red:");
  Serial.println(waterlevel2);
  delay(1000);

  if (waterlevel1 > threshold) {
    digitalWrite(greenLED, HIGH);
  } else {
    digitalWrite(greenLED, LOW);
  }

  if (waterlevel2 > threshold) {
    digitalWrite(redLED, HIGH);
  } else {
    digitalWrite(redLED, LOW);
  }
}

Do they turn off when level,is below the probes?

Weedpharma

weedpharma: Do they turn off when level,is below the probes?

Weedpharma

dangg.. they did not..im confused *head hits wall

just hit me! You need separate 10k resistors. One for each probe.

Weedpharma