This is the first of many ‘Micro:Challenges’ for use by TAG Junior-Engineers with Micro:Bit devices. The intent of this particular post is to create an initial layout, feedback flow, and some interaction to test the concept for ongoing use.


This program, when loaded on two or more Micro:Bits and running in near proximity to each other will allow players to play a simple game that is vaguely similar to Battleship.

How it works | How to play:

  • Load the program on two or more Micro:Bits
  • The game starts with all players on channel 0
  • Players will press button A to change channels on their device
  • The other Micro:Bits that are still on the same channel will also switch to the new channel – BUT some may not have (due to that player also having pressed the A button or their device lagging behind)
  • The current channel that a player’s device is using is displayed on the LED display (0-5)
  • When two or more players are on the same channel, the first player to press the B button will signal the others to play a short melody and present a large ‘X’ on the LED display to signify that they have lost.

Program Code

The code can also be found at

def on_received_number(receivedNumber):
    global channel
    channel = receivedNumber

def on_button_pressed_a():
    global channel
    channel = randint(0, 5)
input.on_button_pressed(Button.A, on_button_pressed_a)

def on_received_string(receivedString):

def on_button_pressed_b():
input.on_button_pressed(Button.B, on_button_pressed_b)

channel = 0


Players can still press the B key – even after they have been disqualified. That does not seem fair.

Players can immediately hit the B key at start of the game – this might be a quick strategy, or it might be a flaw. Perhaps the first press of the B key should be disallowed until after the first channel change?

Can you think of more improvements?

Comments are closed

About This Site

Yeticraft seeks to make learning fun through technology and a community of positive-minded constructive peers and mentors.