This commit is contained in:
Erik Foris 2022-04-12 19:29:16 +02:00
parent 9c77e77860
commit 6d5d05c869
2 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,9 @@
#include <avr/sleep.h>
const int dry = 459; // value for dry sensor
const int wet = 214; // value for wet sensor
float dampPotty;
float onTimePotty;
float solDampness;
@ -24,6 +27,7 @@ void setup() {
// the loop function runs over and over again forever
void loop() {
Serial.print("Licht Sensor");
Serial.println(digitalRead(2));
delay(20);
bedTimeYet();
@ -48,7 +52,8 @@ float calculatePumpOnTime() {
float calculateDampness() {
solDampness = analogRead(A0);
return solDampness / 500;
float percentageHumididy = map(solDampness, wet, dry, 100, 0)/100;
return percentageHumididy;
}
void sleep() {

View File

@ -13,6 +13,7 @@ void loop() {
delay(200);
Serial.println(analogRead(A4));
Serial.println(analogRead(A2));
Serial.print("Dampness Sensor: ");
Serial.println(analogRead(A0));
delay(1000);
}