Micro Polo

Hello there!
I normally am over on the Arcade side of things, but I recently acquired a micro:bit.
I want to detect how far a micro:bit is from another micro:bit whenever you press a button, and perform different actions based on how close the two are. I think the best way to do this would be with radios, but does anyone have any ideas? Thanks in advance!

2 Likes

Pretty sure radio would be the only way to do this (without external parts), though distance would be INCREDIBLY inaccurate, you could get a general sense of distance using it.

Hi @49dev ,

As @WoofWoof said, estimating distance is pretty difficult because of the really complex way that radio waves behave (wave interference).

Here’s an example that might be an ok starting point to explore the idea: https://makecode.microbit.org/S57980-78514-90383-17311 . One micro:bit would act as a transmitter when button A is pressed. Another as a receiver. If the signal is received with enough signal strength, the receiver will show a heart for about 2 seconds.

You can try different values for transmitted signal strength (set in on start) and the “threshold strengths” (set in the if — set at -50 in the example). You can get a very very rough estimate of distance by using certain combinations of transmitted strength and the received signal strength. For example, you may be able to distinguish between very near or “not very near” by using a low transmit strength and only reacting when it’s received with a moderate or high strength.

Good luck! If you find anything interesting, please share.

1 Like

It works perfectly, thank you! :slight_smile: