Hey guys i have made an automatic plant watering system. Its really basic. the code is:-
char yo = 0;
void setup() {
pinMode(2, INPUT);//moisture sensor
pinMode(3, OUTPUT);// pump
Serial.begin(9600);
}
void loop() {
yo = digitalRead(2);
if(yo == 1){
digitalWrite(3,HIGH);
Serial.println("Plant is Being Watered as the soil is dry");
delay(5000);
}
else{
digitalWrite(3,LOW);
delay(5000);
Serial.println("the plant has sufficient water");
}
}
The thing that i want to add is.. i want to add a feature which can manually control it with bluetooth but the normal program should also be running. for eg. soil is wet but i want to add more water so i write 9 on the blueterm app which starts the pump for 2 seconds. I am using an HC-05 bluetooth module. can someone tell me how this can work on an arduino?
EDIT!
Sketch 2:
char ha;
void setup() {
pinMode(3, OUTPUT); //pump
Serial.begin(9600);
}
void loop() {
ha = Serial.read();
if(ha == 5){
digitalWrite(3, HIGH);
delay(2000);
}
else{
digitalWrite(3,LOW);
}
}