Skip to content

Commit

Permalink
define a threshold to the mail alert
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien committed Dec 15, 2021
1 parent 445a267 commit df955c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ See this link https://www.hackster.io/m0by314/calibrate-soil-moisture-sensor-3c3
/* Mail Setting */
#define MAILTO "YOUR_MAIL" /* Replace with your email. */

/* Moisture alert threshold */
#define THRESHOLD "YOUR_MOISTURE_THRESHOLD" /* Replace with your moisture threshold alert */

#endif
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ void setup() {

Serial.printf("Moisture : %i%%\n", soil_moisture_percent);

// Send mail when the percentage of soil moisture lower a 25%
if (soil_moisture_percent <= 25) {
// Send mail when the percentage of soil moisture lower than your threshold
if (soil_moisture_percent <= int(THRESHOLD)) {
// Built the mail
String mail_object = String(PLANT_NAME) + " must be watered";
String mail_body = "The " + String(PLANT_NAME) + " must be watered, the percentage of soil moisture is: " + String(soil_moisture_percent) + ".<br>";
Expand Down

0 comments on commit df955c4

Please sign in to comment.