For a physics project I am trying to use the Ultrasonic sensor (HC-SR04) to measure the distance between itself and a moving cart to measure frictional dissipation. I want to programme so that once the object start to move backwards (as it is on a ramp) it ceases the programme and displays that distance on an lcd.
If anybody has any idea's, it would be a great deal helpful.
When that moment is reached, set a logical flag (a state variable) that directs the program to stop measuring distance and to perform other desired actions.
Yeah that's the way to go, just trying to find a way to describe. Is there any way you could have a clause if object distance > than previously recorded distance == project value to lcd.