Hi in this tutorial we will see how to use ultrasonic sensor as a counter and output will be shown on LCD display. It will count number of times object passes in front of sensor.
Circuit Diagram
Circuit Diagram
Provide separate ground for ultrasonic sensor. And connect VCC pin near to 5V pin. Otherwise it will not work and sensor will give constantly increment values even you are not doing anything with the sensor.
Code
4 Comments
How to Avoid continues count???
ReplyDeleteYou can use the bouncing condition, like below:
Deletebounce_conition();
/*Bounce Condition Fucntion to Stop Continues Count*/
void bounce_conition()
{
while(distance <= Distance)
{
}
}
This is great, works fantastic.
ReplyDeleteWhere would you include the "Bounce Condition" in the sketch?
I am trying to make it count my setup reps during exercise, but it is counting too much.
Hi there why does my counter counts up by its own continuously. I have followed the diagram and the code as explained. Please advise Thx
ReplyDelete