Hi so I programmed my ATtiny85 with the following code to show me when I need to water my plant but it doesn’t work. Could anybody please help me out here?
Thanks in advance!
const int VAL_PROBE = 7; // Analog pin 0
const int MOISTURE_LEVEL = 0; // the value after the LED goes ON
void setup() {
}
void Dry(int state) {
digitalWrite(5, state);
}
//Also, at which point is it in the water, the high numbers (like 1022) or the lower numbers?
void Humid(int state) {
digitalWrite(6, state);
}
void Water(int state) {
digitalWrite(3, state);
}
void loop() {
int moisture = analogRead(VAL_PROBE);
if(moisture >= 170) {
Dry(HIGH);
} else {
Dry(LOW);
}
if(moisture>=70 && moisture<170) {
Humid(HIGH);
} else {
Humid(LOW);
}
if(moisture <70) {
Water(HIGH);
} else {
Water(LOW);
}
delay(1000);
}