3

🧑‍💻 emojifier

 2 years ago
source link: http://suppertime.co.uk/microbit/emojify.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
🧑‍💻 emojifier

🧑‍💻 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 editor

Paste your micro:bit Python code here:

Emojified code


How to use

You'll find a BBC micro:bit Python program already in the top box. Press the 'Emojify my code!' 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 top box. Find some examples here.

To turn emojified code back into Python, simply paste it into the lower box and click on the 'Turn my emojis into Python!' button, and the real code appears in the box above.

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 alpha 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 Twitter.


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

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK