STARLEAP / SPIKE PRIME PYTHON / 2026–27

Build 2026.09.22-090630-0400

On this page

Project 18: Choice Build Remix

You need: a LEGO SPIKE Prime set and the SPIKE App Python editor.

Goal

Choose a LEGO build, then program it with skills you already know.

This project is for pairs who are ready to make choices but still need a clear plan.

Choose A Build

Use the LEGO build menu or the SPIKE App building instructions.

Good choices:

Choose A Coding Skill

Pick one input:

Pick one output:

Pick one structure:

Step 1: Prove One Input Works

Start with the smallest input test.

Example for a force sensor:

CODE
from hub import port
import runloop
import force_sensor

force_port = port.D

def is_pressed():
    return force_sensor.pressed(force_port)

async def main():
    await runloop.until(is_pressed)
    print("pressed")

runloop.run(main())

Run the program.

Observe: Your input should print a message.

Step 2: Prove One Output Works

Example for one motor:

EDIT VIEW · Gray = already there; dark = add or change
from hub import port
import runloop
import motor

motor_port = port.A

async def main():
    await motor.run_for_degrees(motor_port, 180, 300)

runloop.run(main())

Run the program.

Observe: Your output should move, show, beep, or print.

Step 3: Combine Input And Output

Use this shape:

EDIT VIEW · Gray = already there; dark = add or change
from hub import port
import runloop
import force_sensor
import motor

force_port = port.D
motor_port = port.A

def is_pressed():
    return force_sensor.pressed(force_port)

async def main():
    await runloop.until(is_pressed)
    await motor.run_for_degrees(motor_port, 180, 300)

runloop.run(main())

Run the program.

Observe: The input should trigger the output.

Physical Challenge

Make your build do one real job:

Levels:

Extra setup idea: Choose any matching setup from the Challenge Setups sheet.

Teacher Check

Show your teacher:

Before You Put The Kit Away

Save your program. Stop the program before moving wires or changing the build. Show the teacher your working behavior, point to one changed line, and explain what it controls. Keep your place for next time.