On 2016-06-15 15:15, ldompel...@casema.nl wrote:
I have a small robot on wheels named the GoPiGo.
What I want is if the distence sensor read the same distence for let say 5 
seconds then the GoPiGo go's backward.

But I don't now how to program this in python.
The Api functions for the GoPiGo are here: 
http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-raspberry-pi-gopigo/

Can someone help me with this.

Check the distance at regular intervals, like the ticks of a clock.

At each tick, check the distance.

If the distance is the same as the previous measurement, increment a counter, else reset the counter.

If the counter reaches a certain value, it means that the robot has been at that distance for that many ticks. (If it checks every second and the counter reaches 5, then it has been at that distance for 5 seconds ... approximately ...)

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to