Go Down

Topic: ultrasonic sensors for accident avoidance  (Read 116 times) previous topic - next topic

mafify

I need to have an ultrasonic on a vehicle to measure the distance of the vehicle in front of it, in case the vehicle infront of it starts to stop suddenly the Board will detect this.

In order to detect this I need an algorithms to read a sudden decrements in the reading in term of time so

for example if the distance is decreasing 10 cm per second, it's an alert.

Thank you ! 

jremington

#1
Oct 14, 2018, 05:01 pm Last Edit: Oct 14, 2018, 05:03 pm by jremington
velocity = (previous distance - current distance)/(time between readings)

Use the millis() timer to determine the time between two distance measurements.

Go Up