/*--------------------------------------------------------------- GARDENING ----------------------------------------------------------------*/ int light_sensor = A0; int humidity_sensor = A2; int temperature_sensor = A1; int light_led = 13; int humidity_led = 12; int temperature_led = 11; int buzzer = 10; int light_sensor_value=0; int humidity_sensor_value=0; float temperature_sensor_value; void setup() { Serial.begin(9600); pinMode(light_led,OUTPUT); pinMode(humidity_led,OUTPUT); pinMode(temperature_led,OUTPUT); pinMode(buzzer,OUTPUT); } void buzz() { digitalWrite(buzzer,HIGH); delay(200); digitalWrite(buzzer,LOW); delay(200); } void loop() { light_sensor_value=analogRead(light_sensor); humidity_sensor_value=analogRead(humidity_sensor); temperature_sensor_value=analogRead(temperature_sensor); temperature_sensor_value = temperature_sensor_value * 0.48828125; Serial.print("light="); Serial.print(light_sensor_value); Serial.print("\thumidity="); Serial.print(humidity_sensor_value); Serial.print("\ttemp="); Serial.print(temperature_sensor_value); Serial.print("*C"); Serial.println(); delay(100); if(light_sensor_value<=100) { digitalWrite(light_led,HIGH); buzz(); } else digitalWrite(light_led,LOW); if(humidity_sensor_value<200||humidity_sensor_value>=800) { digitalWrite(humidity_led,HIGH); buzz(); } else digitalWrite(humidity_led,LOW); if(temperature_sensor_value<18||temperature_sensor_value>25) { digitalWrite(temperature_led,HIGH); buzz(); } else digitalWrite(temperature_led,LOW); delay(50); }