-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYL69.ino
More file actions
34 lines (26 loc) · 822 Bytes
/
YL69.ino
File metadata and controls
34 lines (26 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void setup() {
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
}
void loop() {
int yellow = 2;
int blue = 3;
int red = 4;
int sensorValue = analogRead(A1);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
if (sensorValue >= 1000) (digitalWrite(yellow, HIGH));
else if ((sensorValue <= 999) && (sensorValue >=901)) (digitalWrite(blue, HIGH));
else if (sensorValue <= 900) (digitalWrite(red, HIGH));
else ;
if (sensorValue >= 1000) (Serial.print("SOIL IS TOO DRY!!!!!"));
else if ((sensorValue <= 999) && (sensorValue >=901)) (Serial.print("SOIL IS PERFECT!!!!!"));
else if (sensorValue <= 900) (Serial.print("SOIL IS TOO WET!!!!!"));
else;
Serial.print("Soil Humidity is: ");
Serial.println(sensorValue);
delay(500);
}