int feuchtsensorA = 4;
int feuchtsensorB = 5;
int feuchtsensor = 6;
int hellsensor = 7;
int PumpeLED = A0;
int FeuchtLED = A1;
int HellLED = A2;
void setup()
{
pinMode(PumpeLED, OUTPUT); // Leuchte für die Pumpe
pinMode(FeuchtLED, OUTPUT); // Leuchte für die sensor
pinMode(HellLED, OUTPUT); // Leuchte wenn es hell wird
pinMode(feuchtsensor, INPUT_PULLUP);
pinMode(feuchtsensorA, INPUT_PULLUP);
pinMode(feuchtsensorB, INPUT_PULLUP);
pinMode(hellsensor, INPUT_PULLUP);
}
void loop()
{
if(digitalRead(hellsensor) == HIGH) //
{
digitalWrite(HellLED,HIGH); //es wird Hell
}
else
{
digitalWrite(HellLED,LOW); //es wird dunkel
}
if(((digitalRead(feuchtsensor) == HIGH && digitalRead(feuchtsensorA) == HIGH)) // Sensor 1 und 2 sind feucht
||((digitalRead(feuchtsensor) == HIGH && digitalRead(feuchtsensorB) == HIGH)) // Sensor 1 und 3 sind feucht
||((digitalRead(feuchtsensorA) == HIGH && digitalRead(feuchtsensorB) == HIGH))) // Sensor 2 und 3 sind feucht
{
digitalWrite(FeuchtLED,HIGH); // es ist Feucht
}
else
{
digitalWrite(FeuchtLED,LOW); // es ist nicht feucht
}
if(digitalRead(hellsensor) == HIGH && (digitalRead(feuchtsensor) == HIGH))
{
digitalWrite(FeuchtLED,HIGH);
}
else
{
digitalWrite(FeuchtLED,LOW);
}
}
OBEN= 0, UNTEN=1