Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

This cheat sheet covers the main micro:bit programming ideas students need for robotics projects. It helps students connect code to hardware, sensors, motors, lights, and radio messages. The reference is useful when building classroom robots because it shows common patterns in a quick, printable format.

Students can use it to debug programs and remember how inputs and outputs work together.

The core ideas are reading inputs, making decisions with if statements, and controlling outputs such as LEDs, buzzers, servos, and motors. A micro:bit program often repeats forever, checks sensors, then chooses an action. Pin values, sensor readings, and radio messages are treated as data that the robot can use.

Good robot code is organized into small steps such as sense, decide, act, and repeat.

Key Facts

  • A forever loop repeats code continuously, so the pattern is forever: read sensor, decide action, control output.
  • A digital pin usually reads or writes two states, where 0 means off or low and 1 means on or high.
  • An analog pin reads or writes a range of values, often 0 to 1023 for sensor readings or power levels.
  • An if statement follows the pattern if condition then action else other action, and the condition must be true or false.
  • A threshold decision compares a sensor value to a limit, such as if light level < 50 then turn on LEDs.
  • Servo angles are commonly set from 0 degrees to 180 degrees, with 90 degrees often used as the middle position.
  • Radio programs must use the same group number, so radio set group 7 can send messages only to other micro:bits in group 7.
  • A robot control pattern can be written as input plus decision equals output, such as button A plus pressed equals drive forward.

Vocabulary

micro:bit
A small programmable computer board with buttons, LEDs, sensors, pins, and radio communication.
Pin
A metal connection point on the micro:bit used to send or receive electrical signals.
Sensor
A device or built-in part that measures something from the environment, such as light, motion, temperature, or sound.
Variable
A named storage place in a program that can hold a value, such as speed = 50.
Conditional
A decision statement that runs different code depending on whether a condition is true or false.
Radio group
A number that lets micro:bits communicate only with other micro:bits using the same group.

Common Mistakes to Avoid

  • Forgetting the forever loop, which makes the robot check a sensor only once instead of continuously responding to changes.
  • Using the wrong pin number, which sends a signal to the wrong motor, servo, LED, or sensor and makes the robot act incorrectly.
  • Mixing up digital and analog values, which is wrong because digital uses 0 or 1 while analog uses a range such as 0 to 1023.
  • Setting radio group numbers differently, which prevents two micro:bits from receiving each other's messages.
  • Using a threshold without testing it, which can make a robot react too early or too late because real sensor values change with the environment.

Practice Questions

  1. 1 A light sensor reads 35, and the program says if light level < 50 then show icon. Will the icon show?
  2. 2 A servo starts at 90 degrees and turns 30 degrees to the right. What angle should the program set next?
  3. 3 Two micro:bits need to send robot commands to each other. If one uses radio group 4, what group must the other use?
  4. 4 A line-following robot keeps turning the wrong way when it sees a dark line. What parts of the sense, decide, act pattern should you check first, and why?