othniel
Published

Water Indicator

When you want to pump water and you do not want to keep checking the water so that it will not overflow you can use this device to check.

IntermediateFull instructions provided304
Water Indicator

Things used in this project

Story

Read more

Schematics

circuit_design_app_for_makers-_circuito_io_pwvqFNG1gh.html

Code

water indicator

C/C++
int buzzPin=8;
int buzzTime=1;
int buzzTime2=800;
const int waterSens = A0; 
//int segPD = ;
int waterVal; 
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(waterSens, INPUT);
  pinMode(buzzPin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  waterVal = analogRead(waterSens); //read the water sensor
  
  Serial.println(waterVal); //bb the value of the water sensor to the serial monitor
if   (waterVal >= 200){
   digitalWrite(buzzPin,HIGH);
delayMicroseconds(buzzTime2);
digitalWrite(buzzPin,LOW); 
delayMicroseconds(buzzTime2);
}
else{
 digitalWrite(buzzPin,LOW);
delayMicroseconds(buzzTime2);
digitalWrite(buzzPin,LOW);
delayMicroseconds(buzzTime2);
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay(5);        
}
}

Credits

othniel
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.