Turn BBC micro:bit Python programs into compact strings of emojis to make a rebus or share longer programs on social media.
You'll find a BBC micro:bit Python program already in the Python box. Press the 'Emojify my Python' button to turn it into emojis. You can copy and paste or tweet your code from there. You can paste or write your own Python programs in the Python box. Find some examples here.
To turn emojified code back into Python, simply paste it into the emoji code box and click on the 'Translate my emojis into Python' button, and the real code appears in the Python box.
To run the code, you need to flash it on to a BBC micro:bit. Use one of the online editors like the lovely new official one or an app like Mu.
This is designed to tokenise micro:bit Python programs using emojis to make them compact enough to share on Twitter, but also human-readable.
It works best with programs that have short variable names and use a lot of the micro:bit's built-in features like its sensors, music, speech, LED display etc.
It may also encourage reluctant students to engage with coding concepts by presenting them in a new, but familiar visual language. You could show emojified version as a rebus or picture puzzle. It could appeal to those who struggle with reading or find large blocks of text hard to process. Maybe students could even write Python programs using emojis. It might make Python more accessible to those who only have mobile devices.
Giles Booth, London, UK - April 2022. @blogmywiki on mastodon.social.
Most micro:bit programs start by importing the functions that make the core micro:bit inputs and outputs work, so it shortens 'from microbit import*' to a single emoji to save space.
To save space, blank lines are shown with the âĐ character at the end of the previous line.
Python uses indentations to mark code that belongs inside loops, if statements and functions. It shows 4 spaces as ã°
while True: loops are useful for checking button presses and sensor readings.
Count-controlled loops start with 'for' - we show them as ð
Use with a 'for' loop to count.
Scroll text or numbers across the LED display.
Put an image or character on the LED display and keep it there.
Clear the LED display.
Many (but not all) of the built-in images have emoji encoding.
Pause your program for a number of milliseconds.
Import other modules into your code, like radio ðŧ, music ðž, speech ðĢ or random ðē.
18 May 22 - put text boxes side-by-side at larger widths
15 Apr 22 - added some instructions
13 Apr 22 - indent character changed from â to ã° for clarity (thank you John!); added various images like ðū and arrows.