В момента ресурсът е наличен само на английски

Teacher's Notes Pro Preview

Необходимо е да се абонирате за FLLCasts.com, за да достъпите това видео

Абонирай се

  • #2602
  • 13 Mar 2026

"Display "Hello World" text on the screen"

from hub import light_matrix
import runloop

async def main():
    light_matrix.write("Hello World")

runloop.run(main())

"Create a numeric variable named "hours" equal to 2 and use the light_matrix.write() command to display it on the screen."

from hub import light_matrix
import runloop

hours = 2

async def main():
    light_matrix.write(str(hours))

runloop.run(main())

"Program the "hours" variable to store a randomly selected number between 1 and 12. Test your program and tell us which number appeared on the display."

from hub import light_matrix
import random
import runloop

hours = random.randint(1, 12)

async def main():
    light_matrix.write(str(hours))

runloop.run(main())

"Create another variable called "minutes" and set it to a random number between 0 and 59. Display it on the screen and tell us which number you saw."

from hub import light_matrix
import random
import runloop

hours = random.randint(1, 12)
minutes = random.randint(0, 59)

async def main():
    light_matrix.write(str(minutes))

runloop.run(main())

"Display the hours and minutes variables separated by a colon."

from hub import light_matrix
import random
import runloop

hours = random.randint(1, 12)
minutes = random.randint(0, 59)

async def main():
    light_matrix.write(str(hours) + ":" + str(minutes))

runloop.run(main())

"How many degrees must the short hand of the clock rotate to show that one hour has passed? (360/12)"

30

"Create a variable called "hour_degrees" equal to the randomly selected number of hours stored in the "hours" variable multiplied by (360 / 12)."

hours = random.randint(1, 12)
hour_degrees = hours * 30

"How many degrees must the long hand of the clock rotate to show that one minute has passed? (360/60)"

6

"Create another variable called "minutes_degrees" equal to the randomly selected number of minutes stored in the "minutes" variable multiplied by (360 / 60)."

minutes = random.randint(0, 59)
minutes_degrees = minutes * 6

"Program the robot’s short hand to rotate by the number of degrees stored in "hour_degrees" at a speed of 360."

from hub import port
import motor
import random
import runloop

hours = random.randint(1, 12)
hour_degrees = hours * 30
minutes = random.randint(0, 59)
minutes_degrees = minutes * 6

async def main():
    motor.run_for_degrees(port.E, hour_degrees, 360)

runloop.run(main())

"Program the robot’s long hand to rotate by the number of degrees stored in "minutes_degrees" at a speed of 360. "

from hub import port
import motor
import random
import runloop

hours = random.randint(1, 12)
hour_degrees = hours * 30
minutes = random.randint(0, 59)
minutes_degrees = minutes * 6

async def main():
    motor.run_for_degrees(port.E, hour_degrees, 360)
    await motor.run_for_degrees(port.F, minutes_degrees, -360)

runloop.run(main())

"Program the robot to wait 5 seconds after moving its hands, then return them to their starting positions."

from hub import port
import motor
import random
import runloop

hours = random.randint(1, 12)
hour_degrees = hours * 30
minutes = random.randint(0, 59)
minutes_degrees = minutes * 6

async def main():
    motor.run_for_degrees(port.E, hour_degrees, 360)
    await motor.run_for_degrees(port.F, minutes_degrees, -360)
    await runloop.sleep_ms(5000)
    motor.run_for_degrees(port.E, hour_degrees, -360)
    await motor.run_for_degrees(port.F, minutes_degrees, 360)

runloop.run(main())

"Put everything together!"

from hub import port, light_matrix
import motor
import random
import runloop

hours = random.randint(1, 12)
hour_degrees = hours * 30
minutes = random.randint(0, 59)
minutes_degrees = minutes * 6

async def main():
    motor.run_for_degrees(port.E, hour_degrees, 360)
    await motor.run_for_degrees(port.F, minutes_degrees, -360)
    await runloop.sleep_ms(5000)
    motor.run_for_degrees(port.E, hour_degrees, -360)
    await motor.run_for_degrees(port.F, minutes_degrees, 360)
    light_matrix.write(str(hours) + ":" + str(minutes))

runloop.run(main())