GoPiGo script

input/ldompeling at casema.nl input/ldompeling at casema.nl
Sat Oct 31 06:28:46 EDT 2015


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)
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))
In reply to "hakugin.gin at gmail.com" who wrote the following:
> On Friday, October 30, 2015 at 2:19:21 PM UTC-4, input/ld... at casema.nl wrot=
> e:
> > Thank you or the reply.
> > This is the errorwith while True:
> > =20
> > File "test03.py", line 10
> > enable_servo()
> > =20
> > =20
> > In reply to "haku... at gmail.com" who wrote the following:
> > =20
> > > On Friday, October 30, 2015 at 12:58:43 PM UTC-4, input/ld... at casema.nl=
> =20
> > wrote:
> > > > The GoPiGo is a little robot on wheels.
> > > > =20
>> <snip>
> > > > enable_servo()
> <snip>
>> If it is returning an error with "enable_servo()" then there are a few poss=
> ible causes. I would make sure everything is indented correctly, as well as=
> check and ensure the function is in the gopigo library. Those would be the=
> 2 most likely causes. As for the issue with the while loop, I would defini=
> tely follow Peter's advice. I started to create a small example script but =
> found that what I classify as simple may not be as simple for others, but I=
> will do my best to get something done over the weekend if you haven't foun=
> d a solution by Monday.

-- 
--------------------------------- --- -- -
Posted with NewsLeecher v7.0 Beta 2
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /