Challenge Set 2¶
Overview¶
Now that you have some experience working in the simulator, it is time to transition to the physical hardware.
Codes from previous session¶
Start by running the programs you developed in the previous session on the MiRo.
Remember the rule about not driving MiRo on the table!
- Clapper control — arena only
- Watch the edge (sonar) — arena only (instead of detecting a drop-off, adjust your threshold to detect a positive obstacle, e.g. a wall)
- Emergency lights — desk-friendly
- Friendly MiRo — desk-friendly
Observe any discrepancies between the simulation and the real world. Hardware often introduces "noise"—physical sensors may react differently. Fine-tune your thresholds and code logic based on these observations.
Once your existing code is running smoothly, challenge yourself with the further implementation ideas listed below.
🔦 Torch (Desk-Friendly)¶
MiRo is equipped with four light sensors: front-left, front-right, rear-left and rear-right.

Program MiRo to react based on which sensor is receiving the most light:
-
Read the Sensors: Use the
block. This returns a list of four values (ranging from 0.0 for total darkness to 1.0 for maximum brightness). -
Compare Intensities: Your code should constantly monitor which of the four sensors has the highest value.
-
Trigger Actions: Assign a unique action to each sensor (e.g., moving the ears, changing LED colors, or making a sound).
-
Whenever the "brightest" sensor changes (e.g., the light moves from the front-left to the back-right), MiRo should trigger the corresponding action for that new sensor.
Warning
Safety First: You may use any action except translational motion (driving forward/backward) or high-volume sounds.
Tip
Testing is easiest using your phone's flashlight!
🎹 Piano (Desk-Friendly)¶
Turn MiRo into an impromptu instrument using its 28 touch sensors (14 on the head, 14 on the body).
Use the
block to this.
Warning
Safety First: Keep volume at or below 50 to remain considerate of other groups.
Tip
Mapping 28 sensors individually is tedious. Consider using a function or a list to handle the mapping between a sensor index and a musical frequency.
♾️ Figure-Eight (Arena Only)¶
Program MiRo to drive in a continuous figure-eight pattern!
Use the
and
blocks to create a smooth, continuous curve.
Fine-tune x and y, you will need to toggle the direction of the turn exactly halfway through the loop.
Warning
This task must be performed in the floor arena. Do not attempt this on a desk.