Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109977
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: GoPiGo distence sensor |
| Date | 2016-06-15 16:00 +0100 |
| Message-ID | <mailman.74.1466002814.2288.python-list@python.org> (permalink) |
| References | <24fc1dae-5411-44fa-89e2-d2859d27594f@googlegroups.com> <14e59bbf-34aa-f83e-ab2f-a623c1380310@mrabarnett.plus.com> |
On 2016-06-15 15:15, ldompeling@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 ...)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
GoPiGo distence sensor ldompeling@casema.nl - 2016-06-15 07:15 -0700 Re: GoPiGo distence sensor Joel Goldstick <joel.goldstick@gmail.com> - 2016-06-15 10:59 -0400 Re: GoPiGo distence sensor MRAB <python@mrabarnett.plus.com> - 2016-06-15 16:00 +0100 Re: GoPiGo distence sensor Joel Goldstick <joel.goldstick@gmail.com> - 2016-06-15 11:13 -0400 Re: GoPiGo distence sensor William Ray Wing <wrw@mac.com> - 2016-06-15 11:47 -0400
csiph-web