I have setup a pi with a grovepi board. I want to use the ultrasonic sensor to count products. The standard value that comes off it is around 500. When a product passes it drops to around 20.
I want to make a counter that increments with 1 every time the sensor payload drops below 500.
How do I program this?