Hello! I am using a HC-204 ultrasound sensor to get distance and with that, I am trying to find the height of water that can be filled in the tank. I am using volume of cylinder to find the volume of water. It however gets stuck at 50cmm cubed. Kindly do let me know what is the error in the code.
define radius 4
define h 8
percent_empty = distance / h; sa = (1-percent_empty)*2*3.14*radius*height; volume = 3.14 * radius * radius * (1 - percent_empty); Serial.print(distance); Serial.println(" cm"); Serial.print(volume,5); Serial.println(" cm cubed"); delay(500);