It’s not necessary to have a micro:bit for each student. I’d recommend having at least 6 set up in a classroom with the following code already flashed onto each microbit.

To flash the micro:bit with the code, click on “Download HEX file”. Save this on to each microbit.

The microbit chooses a random logic gate (AND / OR / NOT) and shows a tick or blank screen to let students discover their own truth table for inputs A and B (microbit buttons)

When you shake the microbit a random number between 1 and 6 appears for 3 seconds. This represents the truth table on a worksheet:
1 or 4: AND
2 or 5: OR
3 or 6: NOT

Hint: you can simulate a “shake” gesture on the micro:bit simulator by clicking on the Accelerometer tab and then press “shake”

You can download the student worksheet here:

Logic Gates worksheet

Logic Gates worksheet








The natural extension to this activity is to get students to experiment with which lets you draw and simulate logic circuits with AND, OR and NOT gates.