Once you have made the micro:bit flash a name or scroll a heart, the natural next step is a project that reacts to you. A shake-to-play rock-paper-scissors game does exactly that, and it needs nothing beyond the board itself: the onboard accelerometer reads the shake, the random number generator picks a move, and the 5x5 LED grid shows the result. It is the perfect second build because it ties together input, logic and display in one small loop.
Quick Answer
You can build rock-paper-scissors on a micro:bit in about fifteen minutes using only the board. Detect a shake with the built-in accelerometer, pick a random number from 0 to 2, and draw rock, paper or scissors on the LED matrix. No wires, no extra parts, and it works in the free MakeCode block editor or in Python.
What you need before you start
This project is deliberately parts-free, which is why it suits beginners and classroom sets so well.
- A micro:bit board (any recent version works for this).
- A USB cable to flash your code, or a battery pack if you want it untethered.
- The MakeCode editor in a browser, or the Python editor if you prefer text.
That is the whole list. Single boards and STEM kits sit in the smart home and maker section at Evetech if you are kitting out a class or a home learner.
Build it step by step
Step 1: Set up the shake trigger
Everything in this game hangs off one event: the shake. In MakeCode, grab an "on shake" block from the Input category. Anything you place inside it runs only when the accelerometer detects that quick back-and-forth motion. This is your start button, no physical button required. Drop the block onto the canvas so the rest of your logic has a home.
Step 2: Generate a random move
Inside the shake block, create a variable, call it something clear like "move", and set it to a random number from 0 to 2. Use the "pick random 0 to 2" block from the Math category. Three possible values map cleanly onto your three choices: 0 for rock, 1 for paper, 2 for scissors. The micro:bit's random generator does the deciding, so every shake is a fresh, unpredictable result.
Step 3: Turn each number into an image
Now translate the number into something the player can read on the LED grid. Add an "if / else if / else" structure and test the value of "move".
- If "move" equals 0, show a solid filled square for rock.
- Else if "move" equals 1, show an open square or a flat shape for paper.
- Else, draw an X or a pair of crossed lines for scissors.
Use the "show LEDs" block so you can light up exactly the pixels you want for each symbol. Spend a minute making the three pictures clearly different from each other; on a 5x5 grid, distinct shapes matter more than detail.
Step 4: Add a little anticipation
A result that snaps up instantly feels flat. Before you reveal the move, show a short rolling animation, for example a quick scrolling arrow or a few frames of random dots, then clear the screen and display the result. A "show string" with a brief "3 2 1" countdown also works. This tiny pause turns a flat output into something that feels like a real game moment.
Step 5: Flash it and test
Connect the micro:bit by USB, download your compiled file, and copy it onto the board the way MakeCode prompts. Once it is running, give the board a firm shake. You should see your countdown, then one of the three symbols. Shake again and again to confirm all three appear over several tries. If only two ever show up, recheck your random range and your if-else conditions.
Step 6: Play against a friend
Hand a second micro:bit to a friend, or take turns shaking the same board. Both players shake on a count of three, compare the symbols, and apply the classic rules: rock beats scissors, scissors beats paper, paper beats rock. Suddenly your code is a real two-player game running on hardware you programmed yourself.
Make it your own
The base game is just the starting point. A few satisfying upgrades:
- Keep score. Add button A and button B as "I won" and "they won" tallies, and show the running totals.
- Add sound. If your board and setup support it, play a short tone on each reveal so the result has a beat.
- Auto-referee. With two boards talking over radio, you can have them swap moves and light up a tick or a cross to declare the winner automatically.
Each of these reuses skills you will want again: variables, conditionals, events and communication. Extra boards, battery packs and accessory bits live in the accessories best sellers aisle if you want to expand a set.
Why this is a strong second project
Rock-paper-scissors is small enough to finish in one sitting but rich enough to teach three core ideas at once: reading a sensor (the shake), making a decision (random choice plus conditionals), and producing output (the LED images). That combination is the backbone of almost every micro:bit project that comes after it, which is exactly why it is such a good rung on the ladder.
Frequently Asked Questions
Do I need any extra components for this project?
No. The shake detection, random number generation and LED display are all built into the micro:bit. A USB cable to flash the code and an optional battery pack are the only extras.
Can I write this in Python instead of blocks?
Yes. MakeCode blocks are friendliest for beginners, but the same logic translates directly to MicroPython using the accelerometer's shake gesture and the random module. Pick whichever editor you are more comfortable in.
Why does my game only ever show two symbols?
That usually means the random range or the if-else conditions are off. Confirm you are picking a random number from 0 to 2 inclusive, and that you have a separate branch for each of the three values.
How do two players compete on one board?
Both players shake on a shared count, then compare the two symbols by eye using the normal rules. For a fully automatic referee, use two boards and the radio blocks to exchange moves.
Is this suitable for a classroom of beginners?
Very. It needs no wiring, finishes quickly, and teaches input, logic and output together, which makes it ideal for a class set where you want a reliable, parts-free win.
Building a STEM set for home or class? Browse micro:bit boards and starter kits in the Evetech maker range and get coding your first game today.