Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97904 > unrolled thread

my first script for the GoPiGo

Started byinput/ldompeling@casema.nl
First post2015-10-22 15:07 +0000
Last post2015-10-22 17:40 +0100
Articles 4 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  my first script for the GoPiGo input/ldompeling@casema.nl - 2015-10-22 15:07 +0000
    Re: my first script for the GoPiGo MRAB <python@mrabarnett.plus.com> - 2015-10-22 16:25 +0100
      Re: my first script for the GoPiGo input/ldompeling@casema.nl - 2015-10-22 15:45 +0000
        Re: my first script for the GoPiGo MRAB <python@mrabarnett.plus.com> - 2015-10-22 17:40 +0100

#97904 — my first script for the GoPiGo

Frominput/ldompeling@casema.nl
Date2015-10-22 15:07 +0000
Subjectmy first script for the GoPiGo
Message-ID<gZ6Wx.71971$pj3.34536@fx05.am1>
I want that this script runs to times from the upper line to the buttom line.
I tried with for x in range(2): but that didn't work
The GoPiGo is a small robot on wheels.

The API codes are here: 
http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-
raspberry-pi-gopigo/


from gopigo import *
import time

for x in range (2):
mindist = 70
servo(120)
time.sleep(2)
fwd()
stop()
time.sleep(2)
bwd()
stop()
if mindist > us_dist(15):
    bwd()
    stop
    print x


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

[toc] | [next] | [standalone]


#97906

FromMRAB <python@mrabarnett.plus.com>
Date2015-10-22 16:25 +0100
Message-ID<mailman.104.1445527523.878.python-list@python.org>
In reply to#97904
On 2015-10-22 16:07, input/ldompeling@casema.nl wrote:
> I want that this script runs to times from the upper line to the buttom line.
> I tried with for x in range(2): but that didn't work

You say "didn't work", but in what way didn't it work?

> The GoPiGo is a small robot on wheels.
>
> The API codes are here:
> http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-
> raspberry-pi-gopigo/
>
>
> from gopigo import *
> import time
>
> for x in range (2):

The lines to be repeated should be indented more than the 'for' line.

> mindist = 70
> servo(120)
> time.sleep(2)
> fwd()
> stop()
> time.sleep(2)
> bwd()
> stop()
> if mindist > us_dist(15):
>      bwd()
>      stop
>      print x
>

[toc] | [prev] | [next] | [standalone]


#97907

Frominput/ldompeling@casema.nl
Date2015-10-22 15:45 +0000
Message-ID<sw7Wx.18238$dl5.11728@fe58.am1>
In reply to#97906
In reply to "MRAB" who wrote the following:

> On 2015-10-22 16:07, input/ldompeling@casema.nl wrote:
> > I want that this script runs to times from the upper line to the buttom 
> > line.
> > I tried with for x in range(2): but that didn't work
> 
> You say "didn't work", but in what way didn't it work?
> 
> > The GoPiGo is a small robot on wheels.
> > 
> > The API codes are here:
> > http://www.dexterindustries.com/GoPiGo/programming/
> > python-programming-for-the-
> > raspberry-pi-gopigo/
> > 
> > 
> > from gopigo import *
> > import time
> > 
Thanks or the reply.

I mean that i want this script running two times.
So the first line is mindist = 70 
And the last line is print x
And that two times
So that the robut continues moving two times in this script, from the upperline 
to the bottum line two times.


> > for x in range (2):
> 
> The lines to be repeated should be indented more than the 'for' line.
> 
> > mindist = 70
> > servo(120)
> > time.sleep(2)
> > fwd()
> > stop()
> > time.sleep(2)
> > bwd()
> > stop()
> > if mindist > us_dist(15):
> >      bwd()
> >      stop
> >      print x
> >




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

[toc] | [prev] | [next] | [standalone]


#97908

FromMRAB <python@mrabarnett.plus.com>
Date2015-10-22 17:40 +0100
Message-ID<mailman.105.1445532055.878.python-list@python.org>
In reply to#97907
On 2015-10-22 16:45, input/ldompeling@casema.nl wrote:
> In reply to "MRAB" who wrote the following:
>
>> On 2015-10-22 16:07, input/ldompeling@casema.nl wrote:
>> > I want that this script runs to times from the upper line to the buttom
>> > line.
>> > I tried with for x in range(2): but that didn't work
>>
>> You say "didn't work", but in what way didn't it work?
>>
>> > The GoPiGo is a small robot on wheels.
>> >
>> > The API codes are here:
>> > http://www.dexterindustries.com/GoPiGo/programming/
>> > python-programming-for-the-
>> > raspberry-pi-gopigo/
>> >
>> >
>> > from gopigo import *
>> > import time
>> >
> Thanks or the reply.
>
> I mean that i want this script running two times.
> So the first line is mindist = 70
> And the last line is print x
> And that two times
> So that the robut continues moving two times in this script, from the upperline
> to the bottum line two times.
>
Then just indent those lines and precede them with the 'for' line.
>
>> > for x in range (2):
>>
>> The lines to be repeated should be indented more than the 'for' line.
>>
>> > mindist = 70
>> > servo(120)
>> > time.sleep(2)
>> > fwd()
>> > stop()
>> > time.sleep(2)
>> > bwd()
>> > stop()
>> > if mindist > us_dist(15):
>> >      bwd()
>> >      stop
>> >      print x
>> >

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web