GoPiGo script
MRAB
python at mrabarnett.plus.com
Sat Oct 31 13:42:04 EDT 2015
On 2015-10-31 10:28, input/ldompeling at 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))
>
More information about the Python-list
mailing list