Magic Emoji Hub
Meet the SPIKE Hub and lock twin-pin side rails; fix flickering v1 icons using pauses and button interaction.
Place the SPIKE Prime Hub
Place the Hub (45601) flat with the 5×5 LED matrix facing up.
- 1 Set the Hub flat on the table, yellow base down, LEDs up.
- 2 Locate the center power button and the Left/Right hub buttons.
-
SPIKE Prime Large HubLEGO #45601×1
Add await runloop.sleep_ms(700) between icons, pair each with a musical tone, and wait for the Hub Left button to trigger a surprise!
Drag and drop blocks just like the Word Blocks in the official SPIKE App. The matching SPIKE 3 Python code updates live and can be sent straight to the Hub.
Your blocks are saved automatically in this browser.
This lesson's blocks use the official SPIKE Scratch block shapes (ports, images and colours are dropdowns, and “set … to” is available). Export .sb3 to open them on scratch.mit.edu.
- 1 Change pauses to 300 ms and add a 4th icon (IMAGE_SMILE) for a mini flipbook.
- 2 Turn it into a two-button mood switcher: Left = HAPPY, Right = SAD.
Add await runloop.sleep_ms(700) between icons, pair each with a musical tone, and wait for the Hub Left button to trigger a surprise!
import runloop
from hub import button, light_matrix, sound
async def main():
# Show heart, play C5 (523Hz), and hold 0.7s
light_matrix.show_image(light_matrix.IMAGE_HEART)
await sound.beep(523, 250, 100)
await runloop.sleep_ms(700)
# Switch to surprised face, play E5, hold 0.7s
light_matrix.show_image(light_matrix.IMAGE_SURPRISED)
await sound.beep(659, 250, 100)
await runloop.sleep_ms(700)
# Scroll GO and wait until Hub Left button is pressed
await light_matrix.write("GO")
while button.pressed(button.LEFT) == 0:
await runloop.sleep_ms(20)
# Celebrate with a happy face and two-note fanfare
light_matrix.show_image(light_matrix.IMAGE_HAPPY)
await sound.beep(784, 200, 100)
await sound.beep(1046, 300, 100)
runloop.run(main())
import runloop
from hub import button, light_matrix, sound
async def main():
# Show heart, play C5 (523Hz), and hold 0.7s
light_matrix.show_image(light_matrix.IMAGE_HEART)
await sound.beep(523, 250, 100)
await runloop.sleep_ms(700)
# Switch to surprised face, play E5, hold 0.7s
light_matrix.show_image(light_matrix.IMAGE_SURPRISED)
await sound.beep(659, 250, 100)
await runloop.sleep_ms(700)
# Scroll GO and wait until Hub Left button is pressed
await light_matrix.write("GO")
while button.pressed(button.LEFT) == 0:
await runloop.sleep_ms(20)
# Celebrate with a happy face and two-note fanfare
light_matrix.show_image(light_matrix.IMAGE_HAPPY)
await sound.beep(784, 200, 100)
await sound.beep(1046, 300, 100)
runloop.run(main())
Line-by-Line Code Explanation
sleep_ms(700) holds the icon for 0.7 seconds so every expression is clearly seen.
Checks the Left button every 20 ms until pressed; click 'Left' in the sim bar to trigger.
- 1 Change pauses to 300 ms and add a 4th icon (IMAGE_SMILE) for a mini flipbook.
- 2 Turn it into a two-button mood switcher: Left = HAPPY, Right = SAD.
How to Install onto Official SPIKE 3 Hub
Method 1: Official SPIKE 3 App Import (Recommended)
Click 'Download .llsp3', open it in the official LEGO Education SPIKE 3 App, and click Play/Download to flash it to a Hub slot.
Method 2: Copy / Paste Python Code
Create a new Python project in the SPIKE 3 App and paste the code or import the downloaded .py file.
Method 3: Flash from the Browser (Chrome / Edge)
Uses LEGO's official SPIKE 3 protocol to write the current code into a slot and run it; print() output from the Hub appears in the log below.
Before connecting over Bluetooth, press the Bluetooth button on the Hub until its light blinks. USB uses the same protocol, but LEGO only documents Bluetooth; if USB does not respond, use Bluetooth.