Introduction
Today’s lesson is inspired by an exciting moment in space exploration - a mission to the Moon. Your robot will act as an astronaut, and you will use an object in the classroom to represent the Moon.
Your robot will travel around the “Moon,” stop at the right moment, and take a picture before returning to its starting point. Instead of a real space camera, you will use a phone set to take photos automatically.
By the end of the lesson, you will have your own mission photo - just like real space engineers who collect data from faraway places.

Тъмната страна на луната
Каква част от повърхността на луната сме наблюдавали през вековете. Кои са лунните фази?
Това са фазите на Луната, които виждаме.

- 🌑 = новолуние
- 🌒 = изгряващ полумесец
- 🌓 = първа четвърт
- 🌔 = растяща луна (наближаваща пълнолуние, млада луна)
- 🌕 = пълнолуние
- 🌖 = намаляваща луна (преминала пълнолуние, стара луна)
- 🌗 = трета (последна) четвърт
- 🌘 = залязващ полумесец
Когато погледнем в небето през нощта, и не само, можем да видим луната. Вероятно малко от вас знаят, обаче, че винаги виждаме една и съща нейна страна. Точно както на картинката, винаги към нас е обърната близката ѝ страна.
Може да си я представите като монета, която винаги се обръща с едната си страна към нас, но ние знаем, че има и друга страна. Тази страна се нарича далечната страна на луната, защото е винаги най-далеч от нас.
Понякога я наричаме и тъмната страна на луната, но това не е правилно, защото тя се осветява циклично и равномерно от всички страни в хода на месеца. За това при новолуние, когато ние не виждаме луната, далечната ѝ страна е най-осветена. Това "заключване" на въртенето на луната и земята се нарича "синхронно въртене".
"Луна 3" е първият автономен космически кораб, който хората са изпратили през 1959г да обиколи Луната и да снима страната, която никога не виждаме. На тази мисия е имало затруднения и част от апаратурата била изключена преди кораба да заобиколи Луната и е предизвикало непланирано понижаване на температурата в кораба с 10 градуса. След като корабът заобиколил Луната, сигналът до Земята бил прекалено слаб за да се изпратят снимките и се наложило да го насочат към Земята за да изпрати снимките, преди да изгори в озоновия слой на атмосферата.
Construction
Today’s robot includes a phone holder, which you will use at the end of the lesson.
Pay attention to which side the holder is on. This will help you decide the direction in which your robot moves around the “Moon.” If the direction is wrong, the robot will face away from the Moon instead of toward it.
Aitken - a LEGO SPIKE Prime Moon Exploration Robot
This robot is named after the South Pole–Aitken Basin, the largest impact crater in the Solar System, located on the far side of the Moon.
Astronauts, get ready to enter lunar orbit! This robot is equipped with a holder for a camera or phone, allowing it to take a picture of the far side of the Moon. If your device does not fit, you can easily adjust the holder to suit your needs.
With its two motors, Aitken can move in both wide and narrow circles around the Moon to capture the perfect photo.
Programming
Today, you will program the robot to move in an arc around the Moon. You will also learn how to break a program into smaller parts, so it is easier to understand, test, and improve.
You will see where to review commands you already know and learn new commands that will help your robot complete the mission.
The "await" command in LEGO SPIKE Python
The await command tells your robot:
“Wait until this action is finished, then continue!”

Why use "await"?
- Motors need time to move
- Sounds need time to play
- Sensors need time to read values
Without "await", the robot may move on too quickly and not finish its actions properly.
Important rule
You can only use "await" inside an "async" function.
async def main(): await motor.run_for_time(port.A, 1000, 1000)
How to use the SPIKE Python API
Here you can find a cheat sheet with the most commonly used commands. There are also more advanced commands that are not included in the built-in API, but the available ones cover most, if not all, of the students’ needs.
Below is an example of a function definition and how to read it:
move_for_degrees(pair: int, degrees: int, steering: int, *, velocity: int = 360, stop: int = motor.BRAKE, acceleration: int = 1000, deceleration: int = 1000) → Awaitable
...
Parameters
pair: int
The motor pair to be used.
degrees: int
The number of degrees the motors should rotate.
steering: int
The steering value (from -100 to 100).
Optional keyword arguments:
velocity: int
The speed of the motor in degrees per second.
...
stop: int
Defines how the motor behaves after it stops. Use constants from the motor module.
...
acceleration: int
The acceleration in degrees per second squared (1–10000).
deceleration: int
The deceleration in degrees per second squared (1–10000).
Let’s take a closer look at the function definition:
The parameters before the "*" symbol are required parameters. You must provide them in the correct order. For example, the first parameter is "pair", so the command expects the motor pair first. The same applies to "degrees" and "steering".
The parameters after the "*" symbol are optional parameters. To change them, you must use their names. This means you cannot just write a number - you need to specify which parameter you are changing. For example:
motor_pair.move_for_degrees(motor_pair.PAIR_1, 360, 0, velocity=280)
Finally, the "Awaitable" keyword means that this command can be used with "await". This allows the program to wait until the command has finished before continuing with the next one. For example:
await motor_pair.move_for_degrees(motor_pair.PAIR_1, 360, 0, velocity=280)
Motor pairs and the "move_for_time()" command
A Motor Pair connects two motors so they can be controlled together. Here is how to do it:
Set up the motors
To create a motor pair, we use the command motor_pair.pair(). Here is an example:
from hub import port import runloop import motor_pair async def main(): # Pair motors on ports F and D motor_pair.pair(motor_pair.PAIR_1, port.F, port.D)
The inputs of the motor_pair.pair() command are:
- First input = Pair number (motor_pair.PAIR_1)
- Second input = Left motor port (port.F)
- Third input = Right motor port (port.D)
The move_for_time() command
This command allows the robot to move for a set amount of time using both motors. Here is an example:
from hub import port import runloop import motor_pair async def main(): # Pair motors on port F and D motor_pair.pair(motor_pair.PAIR_1, port.F, port.D) # Move straight at default velocity for 1 second await motor_pair.move_for_time(motor_pair.PAIR_1, 1000, 0) runloop.run(main())
The inputs of the move_for_time() command are:
- First input = Pair number (motor_pair.PAIR_1)
- Second input = Duration in milliseconds
- Third input = Steering value (from -100 to 100)
The velocity parameter is optional. To change it, you must specify its name:
motor_pair.move_for_time(motor_pair.PAIR_1, 1000, 0, velocity=280)
Move around the Moon

In the following tasks, you will program the robot to move close to an object, go around it, take a picture, and return to you.
Challenge guidelines
Take as many attempts as you need - there is no rush or time pressure for this task.
One important rule: do not touch the pole with the robot - make a smooth and clean turn.
Steps
-
Move forward from the starting line.
-
Make an arc turn around the “Moon” until you reach the back side (find the right settings through trial and error).
-
Wait for 5 seconds.
-
Continue the arc turn until the robot faces the starting line again.
-
Move forward until you reach the starting line.
Tasks to finish a class
- Take pictures and make videos of your robots.
- Turn off the robot.
- Disassemble the robot and return all parts to their places.
- Close all programs on your computer.
- Log out of FLLCasts.
- Shut down your computer.
- Organize your workspace.
- Place the robot electronics on the lid of the box.
- Wrap the mouse cable neatly around the mouse.
- Wrap the laptop charger cable as your teacher shows you.
- After turning off the computer, place it next to the robot box.
- Put your chair under the desk.
