#include <LiquidCrystal.h>

#define LED_PIN     2
#define POWER_PIN   7
#define SIGNAL_PIN  A5
#define THRESHOLD   75


/* Display */
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

int value = 0; // variable to store the sensor value

void setup() {
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(LED_PIN,   OUTPUT);   // configure D2 pin as an OUTPUT
  pinMode(POWER_PIN, OUTPUT);   // configure D7 pin as an OUTPUT
  digitalWrite(POWER_PIN, LOW); // turn the sensor OFF
  digitalWrite(LED_PIN,   LOW); // turn LED OFF
}

void loop() {
  digitalWrite(POWER_PIN, HIGH);  // turn the sensor ON
  delay(10);                      // wait 10 milliseconds
  value = analogRead(SIGNAL_PIN); // read the analog value from sensor
  digitalWrite(POWER_PIN, LOW);   // turn the sensor OFF

  if (value < THRESHOLD) {
    Serial.println ("No water is detected");
    lcd.setCursor(0,0);
    lcd.print("ik heb dorst!  ");
    digitalWrite(LED_PIN, HIGH);  // turn LED ON
  } else {
    digitalWrite(LED_PIN, LOW);   // turn LED OFF
    Serial.println(value);
    lcd.setCursor(0,0);
    lcd.print("het gaat prima!");
  }
}