<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Lego Python Robodojo by Burlington CN</title>
      <link>https://padlet.com/codeninjassummer/legopythonrobodojo</link>
      <description></description>
      <language>en-us</language>
      <pubDate>2025-07-28 20:06:00 UTC</pubDate>
      <lastBuildDate>2025-08-08 16:40:41 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url>https://padlet-uploads-usc1.storage.googleapis.com/2192912889/d4a4442dff5b7ea09362ea45494d5cd3/ninjarobotics_4x.png</url>
      </image>
      <item>
         <title>Day 2 Scripts</title>
         <author>ianchan17</author>
         <link>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3530306554</link>
         <description><![CDATA[<p><strong>Slide 9:  (motor command incomplete)A</strong></p><p>#import libraries</p><p>from hub import light_matrix, port</p><p>import motor</p><p>import runloop</p><p><br></p><p>async def main():</p><p>          # rotate clockwise for 2 secs at 75 degrees per second</p><p>          motor <strong>XXXX</strong></p><p><br></p><p>runloop.run(main())</p><p><br></p><p><strong>Slide 12 (Await commands incomplete)</strong></p><p>async def main():</p><p>   # rotate the motor to position 0</p><p>   await motor.run_to_absolute_position(port.C,<strong>XXX</strong></p><p>   # rotate the motor 360 degrees clockwise</p><p>   await motor.run_for_degrees(port.C, <strong>XXX</strong></p><p>   # how will this motor rotate?</p><p>   await motor.run_for_degrees(port.C, <strong>XXX</strong></p><p><br></p><p>runloop.run(main())</p><p><br></p><p>Reuse the above code for slides 13 &amp; 15</p><p><br></p><p><strong>Slide 28</strong></p><p># Import libraries</p><p>from hub import light_matrix, port</p><p>import motor</p><p>import runlop</p><p><br></p><p><strong>Slide 29</strong></p><p>#use a variable to set the driving speed</p><p>driving_speed = <strong>XXX </strong></p><p>#display the speed on the hub</p><p><br></p><p><strong>Slide 30</strong></p><p>#definte a function for riding</p><p>async def ride():</p><p>   #Display the speed on the hub</p><p>  await light_matrix.write(str(driving_speed))</p><p>  motor.run_for_time(port.C, <strong>XXXXX</strong></p><p>  motor.run_for_time(port <strong>XXXXXX</strong></p><p><br></p><p>runloop.run(ride())</p><p><br></p><p><strong>Slide 36</strong></p><p># change the speed of the bike when going uphill</p><p>while True:</p><p>   #get the current angle of the motion sensor</p><p>   angle =  motion_sensor.tilt_angles()</p><p>   print(angle)</p><p>   driving_speed = 600</p><p>   #if the angle is greater than 20, you are going uphill</p><p>   if angle[1] &gt;= <strong>XXX</strong></p><p>           driving_speed = driving_speed - <strong>XXX</strong></p><p>           runloop.run(ride())</p><p>           break</p><p>   else</p><p>           runloop.run(ride())</p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2025-07-28 20:46:27 UTC</pubDate>
         <guid>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3530306554</guid>
      </item>
      <item>
         <title>DAY 3 SLIDES</title>
         <author>ianchan17</author>
         <link>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3531555414</link>
         <description><![CDATA[<p><strong>Slide 11</strong></p><p># import libraries</p><p>from hub import light_matrix, port</p><p>import runloop, force_sensor, motor_pair</p><p>#set variables</p><p>fs = <strong>XXXX</strong></p><p>motor_pair.pair(motor_pair.PAIR_1, port.C, port.D)</p><p>cir = motor_pair.PAIR_1</p><p><br/></p><p><br/></p><p><strong>Slide 17</strong></p><p># set speed of motors</p><p>motor_speed = <strong>XXXX</strong></p><p><br/></p><p>#start moving when force sensor is pressed</p><p>async def main():</p><p>  if force_sensor.pressed(fs):</p><p>       motor_pair.move(car, <strong>XXX</strong>, velocity = <strong>XXX</strong>)</p><p>  else</p><p>       motor_pair.<strong>XXXXX</strong></p><p>while True:</p><p>   runloop.run(main())</p><p><br/></p><p><br/></p><p><strong>Slide 21</strong></p><p># import libraries</p><p>from hub import light_matrix, port</p><p>import runloop, color_sensor, motor_pair</p><p>#set variables</p><p>cs = <strong>XXXX</strong></p><p><br/></p><p><strong>Slide 22</strong></p><p>motor_pair.pair(motor_pair.PAIR_1, port.C, port.D)</p><p>car = motor_pair.PAIR_1</p><p># set speed of the motors</p><p>motor<strong>XXXXX</strong></p><p><br/></p><p><strong>Slide 25</strong></p><p># import libraries</p><p>from hub import light_matrix, port</p><p>import runloop, color_sensor, motor_pair, color</p><p>#set variables</p><p><br/></p><p>cs = port.B</p><p>motor_pair.pair(motor_pair.PAIR_1, port.C, port.D)</p><p>car = motor_pair.PAIR_1</p><p># set speed of the motors</p><p>motor<strong>XXXXX</strong></p><p><br/></p><p>async def main():</p><p>   while True:</p><p>        if color_sensor.color(cs) is not color.BLACK:</p><p>               motor_pair.move(car, <strong>XXX, </strong>velocity = <strong>XXXX</strong>)</p><p>        else</p><p>               motor_pair<strong>XXXXX</strong></p><p><br/></p><p>runloop.run(main())</p><p><br/></p><p><strong>Slide 30 (lines 15-18)</strong></p><p>if color_sensor.color(cs) is not color.BLACK:</p><p>    motor_pair.move_tank(car,0,motor_speed)</p><p>else</p><p>    motor_pair.move_tank(<strong>XXXX</strong></p><p><br/></p><p><strong>Slide 43</strong></p><p># import libraries</p><p>from hub import light_matrix, port</p><p>import runlook, motor_pair, motor, <strong>XXXX</strong></p><p>#pair your drive motors</p><p>motor_pair.pair(motor_pair.PAIR_1, port.C, port.D)</p><p># initialize variables</p><p>driveMotors = motor_pair.PAIR_1</p><p>arm = <strong>XXXXX</strong></p><p>distanceSensor = port.F</p><p><br/></p><p><br/></p><p><strong>Slide 48</strong></p><p>#set speed</p><p>driveSpeed = <strong>XXX</strong></p><p>arm<strong>XXX</strong></p><p># define the function</p><p>async def main():</p><p><br/></p><p><strong>Slide 49</strong></p><p>#set arm in place</p><p>await motor.run_for_time(arm, 500, armSpeed)</p><p>await motor.run_for_degrees( <strong>XXXX</strong></p><p>#beep to show the arm is ready</p><p>await sound.beep(<strong>XXXX</strong></p><p>await sound.beap(510, 500)</p><p><br/></p><p>#run the function</p><p>runloop.run(main())</p><p><br/></p><p><strong>Slide 54</strong></p><p>distance = 200</p><p>async def move():</p><p><br/></p><p>#loop the movement</p><p>while True:</p><p>    runloop.run(move())</p><p><br/></p><p><br/></p><p><strong>Slide 55</strong></p><p>distance = 200</p><p>async def move():</p><p>  if distance_sensor.distance(distanceSensor) &gt; <strong>XXX</strong></p><p>      motor_pair.move(driveMotors, 0, velocity = driveSpeed)</p><p><br/></p><p>  else</p><p>       motor_pair.stop(driveMotors)</p><p><br/></p><p><br/></p><p><strong>Slide 58</strong></p><p>else</p><p>   motor_pair.stop(driveMotors)</p><p>   # drop the arm</p><p>  await motor.run_for_degrees(arm, <strong>XX</strong>, -armSpeed)</p><p>   #beep to show the robot has picked up the object</p><p>  await sound.beep(440, 500)</p><p>  await sound.beep(<strong>XXXX</strong></p><p>  # move backwards and lift arm</p><p>  await motor_pair.move_for_time(driveMotors, 1500, 0, veolocity=-driveSpeed)</p><p>  await motor.run_for_degrees(arm, <strong>XX,</strong> armSpeed)</p><p><br/></p><p><br/></p><p><br/></p><p><br/></p><p><br/></p><p><br/></p>]]></description>
         <enclosure url="" />
         <pubDate>2025-07-30 02:51:06 UTC</pubDate>
         <guid>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3531555414</guid>
      </item>
      <item>
         <title>Day 1 Scripts</title>
         <author>cnstcatharines</author>
         <link>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3536109824</link>
         <description><![CDATA[<p>Slide 21:</p><p>from hub import light_matrix, sound</p><p>import runloop, time</p><p><br></p><p>Slide 25 Driver: </p><pre><code class="language-python">#import our necesarry libraries
import motor
from hub import port, button
import runloop

async def main():
    #make the hand open once to start
    motor.run_for_time(port.F, 1000, 300)
    #begin checking for button presses
    runloop.run(checkButtons())
#A function that calls itself to keep checking the buttons
async def checkButtons():  
    #when the button is not pressed, open the hand
    while not button.pressed(button.LEFT):
        motor.run(port.F, 300)
    #when the button is pressed, close the hand.
    while button.pressed(button.LEFT):
        motor.run(port.F, -300)
    #loop the function
    runloop.run(checkButtons())


runloop.run(main())</code></pre><p><br></p><p><br></p>]]></description>
         <enclosure url="" />
         <pubDate>2025-08-05 16:42:15 UTC</pubDate>
         <guid>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3536109824</guid>
      </item>
      <item>
         <title>Day 4 Scripts - Counting Steps</title>
         <author>cnstcatharines</author>
         <link>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3538727163</link>
         <description><![CDATA[<pre><code class="language-python"># These lines import the functions of the hub we use to make our code.
from hub import light, light_matrix, motion_sensor, button
import runloop
step = 0
true_step = 0

#This function is defined here with async def
async def main():
    global step
    global true_step
    #Retrieve the yaw angle
    yaw = motion_sensor.tilt_angles()[0]
    if yaw &gt; 100 and true_step == 0:
        step += 1
        true_step = 1
    elif yaw &lt; -100 and true_step == 1:
        step += 1
        true_step = 0
    # Press the left button to vview how many steps you have walked
    if button.pressed(button.RIGHT):
        step = 0
        await light_matrix.write(str(step))
    print("Yaw Angle: " + str(yaw))


while True:
    runloop.run(main())
</code></pre>]]></description>
         <enclosure url="" />
         <pubDate>2025-08-08 16:39:36 UTC</pubDate>
         <guid>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3538727163</guid>
      </item>
      <item>
         <title>Day 4 - Robot Coach</title>
         <author>cnstcatharines</author>
         <link>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3538727580</link>
         <description><![CDATA[<pre><code class="language-python">from hub import port
import runloop, motor
# initialize motors
motor_left = port.B
motor_right = port.F

async def main():
    # write your code here
    await motor.run_to_absolute_position(motor_left, 0, 440)
    await motor.run_to_absolute_position(motor_right, 0, 440)


    # Run motors in alternating moves
    for count in range (10):
        await motor.run_for_time(motor_right, 200, 600)
        await motor.run_for_time(motor_left, 200, -600)

        await motor.run_for_time(motor_right, 200, -600)
        await motor.run_for_time(motor_left, 200, 600)

runloop.run(main())


</code></pre>]]></description>
         <enclosure url="" />
         <pubDate>2025-08-08 16:40:40 UTC</pubDate>
         <guid>https://padlet.com/codeninjassummer/legopythonrobodojo/wish/3538727580</guid>
      </item>
   </channel>
</rss>
