Automated Hydro-Monitor
/* * PROJECT: Automated Hydro-Monitor V4.0
- LEVEL: Grade 10 (High School)
- CONTEXT: Izmir-Lithuania STEM Collaboration */
const int SENSOR_INPUT = A0; // Moisture Probe
const int STATUS_OK = 8; // Green LED
const int STATUS_ALERT = 9; // Red LED
const int DRY_LIMIT = 300; // Calibrated Threshold
void setup() {
Serial.begin(9600); // Initialize Serial Telemetry
pinMode(STATUS_OK, OUTPUT);
pinMode(STATUS_ALERT, OUTPUT);
}
void loop() {
int sensorData = analogRead(SENSOR_INPUT);
Serial.print(“DATA_STREAM:”);
Serial.println(sensorData);
if (sensorData < DRY_LIMIT) {
digitalWrite(STATUS_ALERT, HIGH); // Trigger Alert
digitalWrite(STATUS_OK, LOW);
} else {
digitalWrite(STATUS_ALERT, LOW); // System Normal
digitalWrite(STATUS_OK, HIGH);
}
delay(1000); // Sampling Rate: 1Hz
}