Sunday 12 April 2015

The fun of the fair


Following our trip over Easter to (more than one) theme park, the boys'  latest Lego building extravaganza was to build their own resort, complete with rides and even a queueing system. Following the success of Chicken Pi, they decided to motorise a couple of the rides.


Once again using the excellent Smart Pi case, they developed and programmed a nifty pair of spinning attractions.



Here's the Python they wrote to drive the rides. I have no idea about the choice of names of the variables...

from wedo import WeDo
import time as t

i=WeDo()
croc=20
i.motor_a=croc

cro=20
i.motor_b=cro
#while True:

for gator in range (80):
    t.sleep(0.2)
    croc=croc+1
    i.motor_a=croc
    t.sleep(0.2)
    cro=cro+1
    i.motor_b=croc

for ali in range(100):
    t.sleep(0.1)
    croc=croc-1
    i.motor_a=croc
    t.sleep(0.1)
    cro=cro-1
    i.motor_b=cro
    if croc==20:
        i.motor_a=0
       


Although judging by the state of some of the riders after a trip, I'm not sure they will get much repeat business.




Now that school starts again, I'm not sure that the resort will ever be completed. Nevertheless, here are few of the other (largely fatal) rides they've dreamed up.










No comments:

Post a Comment