 int startup_seconds = 900; // sensor needs to settle for 15 minutes
 
 int get_humidity() {
-  sensorValue = analogRead(sensorPin);
+  int sensorValue = analogRead(sensorPin);
   
   // sensor value is high when humidity is low, this is
   // counterintuitive (it's a dryness sensor!), so we

  Serial.println(avg + deviation);

  // switch the relays!
  if (sensorValue < thresholdLow) {
    // HIGH means setting the relay to NC
    digitalWrite(relaisPin, HIGH);
  } else if (sensorValue > thresholdHigh) {
    // LOW means setting the relay to NO
    digitalWrite(relaisPin, LOW); 
  }
  delay(milliseconds_sleep);
}

#include <Time.h>

const int relayPin =  11;
const int sensorPin = A0;    // select the input pin for the potentiometer
const int MINHUMIDITY = 0;
const int MAXHUMIDITY = 1023;
const int milliseconds_sleep = 5000;
const int avg_decay = 0.00001;
const int deviation_decay = 0.01;
int thresholdLow = 0;
int thresholdHigh = 0;
int avg = 0;
