One of the features of the Micro:Bit is its Bluetooth compatible radio.
Unfortunately, it is not available in Micropython due to the size of the Bluetooth software stack.
Whatt is available is a Radio object which uses the radio hardware to communicate between Micro:bits.
There is a neat program on the documentation site called Firefly. This has groups of Micro:bits communicating with each other.
Now this project uses the "flash" technique from the Firefly project.
from microbit import *
import radio
import utime
import machine
# "Flash" effect from the Firefly program
#https://microbit-micropython.readthedocs.io/en/latest/tutorials/radio.html?highlight=Firefly#fireflies
flash = [Image().invert()*(i/9) for i in range(9, -1, -1)]
# Obtain the machine id
machineID=machine.unique_id()
# Flash the display over a half second
# and send the machine ID every second.
while True:
display.show(flash, delay=50, wait=False)
radio.on()
radio.send(str(machineID))
sleep(500)
radio.off()
sleep(500)