Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!posting6.xlned.com!fe45.am1.POSTED!not-for-mail From: input/ldompeling@casema.nl Newsgroups: comp.lang.python Subject: Re: GoPiGo script X-Newsreader: NewsLeecher v7.0 Beta 2 (http://www.newsleecher.com) References: Lines: 107 Message-ID: X-Complaints-To: abuse@n-o-s-p-a-m.pureusenet.nl NNTP-Posting-Date: Sat, 31 Oct 2015 20:18:21 UTC Organization: Pure Usenet - Usenet for everyone Date: Sat, 31 Oct 2015 20:18:21 GMT X-Received-Bytes: 3133 X-Received-Body-CRC: 2254271763 X-Original-Bytes: 3166 Xref: csiph.com comp.lang.python:98022 > It does not only print; it also calls enable_servo, servo and fwd > repeatedly. > Then I am misinformed, because someone told me in this group to use while True: Is there another function that I can use for to restart this script? Thanks In reply to "MRAB" who wrote the following: > On 2015-10-31 18:59, input/ldompeling@casema.nl wrote: > > > The body of the 'while' loop extends from the line: > > > > > > enable_servo() > > > > > > to the line: > > > > > > print ("forward1x") > > > > > > Would that explain it? > > > > When i run this scipt its only print a lot off print1x. > > Do you mean that ? > > > It does not only print; it also calls enable_servo, servo and fwd > repeatedly. > > > > > In reply to "MRAB" who wrote the following: > > > > > On 2015-10-31 10:28, input/ldompeling@casema.nl wrote: > > > > I intended the rules under while True: > > > > The script is working now only the wheels go's only forward "(fwd)",so > > > > the > > > > sensor not detect any obstacles.(sensor=us_dist(15). > > > > > > > > > > ---------------------------------------------------------------------------- > > > > --- > > > > > > > > from gopigo import * > > > > import time > > > > > > > > > > > > set_right_speed(150) > > > > set_left_speed(105) > > > > > > > The body of the 'while' loop extends from the line: > > > > > > enable_servo() > > > > > > to the line: > > > > > > print ("forward1x") > > > > > > Would that explain it? > > > > > > > while True: > > > > #def test(): > > > > enable_servo() > > > > mindist = 80 > > > > servo(90) > > > > fwd() > > > > print ("forward1x") > > > > #time.sleep(5) > > > > #stop() > > > > > > > > if mindist > us_dist(15): > > > > #enc_tgt(1,1,72) > > > > bwd() > > > > print ("backward1x",us_dist(15)) > > > > time.sleep(2) > > > > left_rot() > > > > print("left rot",us_dist(15)) > > > > time.sleep(3) > > > > stop() > > > > > > > > if mindist < us_dist(15): > > > > #enc_tgt(1,1,72) > > > > fwd() > > > > print("forward2x",us_dist(15)) > > > > time.sleep(2) > > > > stop() > > > > > > > > for x in range(3): > > > > > > > > if mindist > us_dist(15): > > > > bwd() > > > > print("backward2x",us_dist(15)) > > > > -- --------------------------------- --- -- - Posted with NewsLeecher v7.0 Beta 2 Web @ http://www.newsleecher.com/?usenet ------------------- ----- ---- -- -