🧑‍ðŸ’ŧ micro:bit Python emojifier

Turn BBC micro:bit Python programs into compact strings of emojis to make a rebus or share longer programs on social media.

Python

Emoji code


How to use

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.


About

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.


Partial dictionary

🔝 from microbit import *

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.

â†Đ blank lines

To save space, blank lines are shown with the â†Đ character at the end of the previous line.

〰 indents

Python uses indentations to mark code that belongs inside loops, if statements and functions. It shows 4 spaces as 〰

🔁 while True: (infinite loop)

while True: loops are useful for checking button presses and sensor readings.

🔂 for loop

Count-controlled loops start with 'for' - we show them as 🔂

ðŸ”Ē in range

Use with a 'for' loop to count.

📚📜 display scroll

Scroll text or numbers across the LED display.

📚💁 display show

Put an image or character on the LED display and keep it there.

📚ðŸšŋ display clear

Clear the LED display.

🖞âĪ Image.HEART

Many (but not all) of the built-in images have emoji encoding.

ðŸ’Ī sleep

Pause your program for a number of milliseconds.

ðŸ“ē import

Import other modules into your code, like radio ðŸ“ŧ, music 🎞, speech ðŸ—Ģ or random ðŸŽē.


Ch-ch-ch-changes

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.