Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Joel Goldstick Newsgroups: comp.lang.python Subject: Re: GoPiGo distence sensor Date: Wed, 15 Jun 2016 11:13:11 -0400 Lines: 35 Message-ID: References: <24fc1dae-5411-44fa-89e2-d2859d27594f@googlegroups.com> <14e59bbf-34aa-f83e-ab2f-a623c1380310@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de nNaEUgugN76NPqbYXuxWCgcQKc75AEdQKkuPX629iZ9g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'value,': 0.03; 'mrab': 0.05; 'api': 0.09; 'cc:addr:python- list': 0.09; 'url:blog': 0.10; 'python.': 0.11; 'wed,': 0.15; '...)': 0.16; '2016': 0.16; 'clock.': 0.16; 'increment': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'ticks': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'reaches': 0.27; 'this.': 0.28; 'regular': 0.29; 'url:wikipedia': 0.29; 'reset': 0.29; 'url:wiki': 0.30; 'url:mailman': 0.30; '15,': 0.30; 'checks': 0.30; 'seconds': 0.31; 'certain': 0.31; 'url:python': 0.33; 'url:listinfo': 0.34; 'previous': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'received:209': 0.38; 'someone': 0.38; 'means': 0.39; 'url:en': 0.39; 'url:mail': 0.40; 'called': 0.40; 'distance': 0.63; 'here:': 0.63; 'url:info': 0.71; '1980s': 0.84; 'reminds': 0.84; 'toy': 0.84; 'url:programming': 0.84; 'wheels': 0.84; 'to:none': 0.91; 'distance.': 0.91; 'joel': 0.91; 'robot': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=R641ag0M6uAG23OqSfWevsdiHgkx0vgYPbAp94EE3og=; b=eCjjNGEvtPBRThmFQg+V9Hk4iRRP+Ld1MPixCJ5eiaPZLxWaVr5wSCyClkEs0ZXsgn zUX9GSuoW/QLH/PIP+Ifxt04LJngaXnWHsYj/3SIgzbgKLu4FaKRqIE9nAgxvy9FYNCK 0gZiFeYRjQwSeTGwAQbT3BcVUkQWz2w18GVtJMW8b4f+DV2AIYaC7lelN8okT/iRiXZV x1wAK1oQOgfRF7M6AMkmluRUzPXuy4h3EQCrISNhtHY6o4W+XhNbqCJs77no2hd5zTps eTkWwX0mO8KtsSC7YwNeQwFyBKAYkyRicAE0gkadzDv0y88U7DX8o2CsF7JHMfHLuKTM gqgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=R641ag0M6uAG23OqSfWevsdiHgkx0vgYPbAp94EE3og=; b=E9wdO1Biz3fo5k6mOeszZLTGMSMDi9DqbdxpjAjk85IbuIFeRSh2BEbOQ/e4Nefulb PK34NW3DcCJwqO0zUEYVOpoL/VwEPyMtdlbwLBcQWIRwuiagyiUcFwZNR7GAnbdwN365 anJEhA1bXju36EOe2OFQifOZuye74NPoBYOer6NVlSSWHgmUZHd7P8nae65x41ZuC8sm vvlpWoqS127JxkwAmujDv1o1Fcb5lnA0r52GDKh4/85bKOppVOLzuPsyfjK/L5qtjwwY wKnCTQKuMgg+vWKquHUPMaDUvVPTx/0nwDismhdnCWUp2K4yuaRmJysK+zc4ENWkz+7k qnow== X-Gm-Message-State: ALyK8tLUtzDSCWu3hg+dbhQIr1h6/mACSkYF/q9rkCGXXYMk69pYkA4bglsQGJfo816Pbrh0PJ1eqtDFGQ4QoA== X-Received: by 10.157.29.10 with SMTP id m10mr15088961otm.196.1466003592238; Wed, 15 Jun 2016 08:13:12 -0700 (PDT) In-Reply-To: <14e59bbf-34aa-f83e-ab2f-a623c1380310@mrabarnett.plus.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <24fc1dae-5411-44fa-89e2-d2859d27594f@googlegroups.com> <14e59bbf-34aa-f83e-ab2f-a623c1380310@mrabarnett.plus.com> Xref: csiph.com comp.lang.python:109978 On Wed, Jun 15, 2016 at 11:00 AM, MRAB wrote: > 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 ...) > > -- > https://mail.python.org/mailman/listinfo/python-list This reminds me of a toy called 'Big Trak' made by Milton Bradley in the 1980s https://en.wikipedia.org/wiki/Big_Trak -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays