Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
Fix LEDs
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLua authored Apr 7, 2024
1 parent e5375f7 commit 7162c63
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/Plant_Watering_Kit/Plant_Watering_Kit.ino
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,21 @@ void loop()
Serial.println(moisture);

// Set the LED behavior according to the moisture percentage or watering status
if (moisture < 40)
if (moisture < 10)
{
// warning, slow blink
// digitalWrite(LEDR, (millis() % 1000) < 500);
// need water, fast blink
digitalWrite(LEDR, HIGH);
delay(250);
digitalWrite(LEDR, LOW);
delay(250);
}
else if (moisture < 10)
else if (moisture < 40)
{

// need water, fast blink
// digitalWrite(LEDR, (millis() % 500) < 250);
// warning, slow blink
digitalWrite(LEDR, HIGH);
delay(500);
digitalWrite(LEDR, LOW);
delay(500);
}
else
{
Expand Down Expand Up @@ -113,12 +118,16 @@ void startWatering()
watering = true;
startedWatering = millis();
digitalWrite(RELAY_PIN, LOW);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LED_BUILTIN, HIGH);
}

void stopWatering()
{
watering = false;
digitalWrite(RELAY_PIN, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, LOW);
}

void onWaterTimeChange()
{
}

0 comments on commit 7162c63

Please sign in to comment.