Program Milo (tilt messages)

Create (continued). This program watches the tilt sensor and sends two different signals:

  • Tilt the arm down → the Smart Hub's LED turns red.
  • Tilt the arm up → a text message appears on the screen.
  • Return to flat → signals clear.

Prompt: what other signals could Milo send? Different colours? Sounds? What might each one mean?

Mission program. Press Start. Milo watches the tilt sensor and sends a signal to base based on how the arm is pointed.

What you're coding towards

This is one program that keeps going round and round on the Code canvas. It waits for the arm to tilt up. Then it flashes the red light and shows a number. Then it waits for the arm to tilt down. Then it turns the light off and shows the word "Milo". Then it starts again.

▶
⧖↑
●9
123
⧖↓
●0
123Milo
↺

The Signal board below runs the same program in the browser — a working example to compare your blocks against.

Signal board

🔴 Tilt UP → red light + number
📨 Tilt DOWN → light off + "Milo"
Milo's screen — numbers and words will show here
Roll 0° · Pitch 0°
What each block does
▶
Start the program.
⧖↑
Wait until the tilt sensor is tilted up. Nothing happens until the arm goes up.
●9
Turn the hub LED red (colour 9).
123
Show a number on the iPad (the sensor's reading).
⧖↓
Wait until the arm tilts down.
●0
Turn the LED off (colour 0).
123Milo
Show the word "Milo" on the iPad.
↺
Loop back to the start. The whole thing runs again, forever.