Nautilus

From Project Phoenix
Jump to navigation Jump to search

Nautilus[edit]

Robotic system to monitor and maintain an aquatic habitat.

System Monitor[edit]

Soil Sensor[edit]

code[edit]

 1 /*
 2  
 3  All the resources for this project:
 4  https://randomnerdtutorials.com/
 5  
 6 */
 7 
 8 int rainPin = A0;
 9 int greenLED = 6;
10 int redLED = 7;
11 // you can adjust the threshold value
12 //int thresholdValue = 800;
13 int thresholdValue = 550;
14 
15 void setup(){
16   pinMode(rainPin, INPUT);
17   pinMode(greenLED, OUTPUT);
18   pinMode(redLED, OUTPUT);
19   digitalWrite(greenLED, LOW);
20   digitalWrite(redLED, LOW);
21   Serial.begin(9600);
22 }
23 
24 void loop() {
25   // read the input on analog pin 0:
26   int sensorValue = analogRead(rainPin);
27   Serial.print(sensorValue);
28   if(sensorValue < thresholdValue){
29     Serial.println(" - Doesn't need watering");
30     digitalWrite(redLED, LOW);
31     digitalWrite(greenLED, HIGH);
32   }
33   else {
34     Serial.println(" - Time to water your plant");
35     digitalWrite(redLED, HIGH);
36     digitalWrite(greenLED, LOW);
37   }
38   delay(500);
39 }

Temperature[edit]