Here is a screenshot of one the first examples in MicroCode: smiley buttons.
The goal of this program is to show a smiley and plays a happy sound when pressing A, and a frowney animation and unhappy sound when B is pressed.
The MicroCode language, is defined in terms of pages, where a page has a list of rules, and each rule consists of a When section and a Do section, each with a list of programming tiles. For this example, we have 4 rules.
The first rule tells MicroCode to show an image when 'A' is pressed on the micro:bit.
You will find more samples in the MicroCode documentation.
- when
press
button A, do
show image smiley.
The next rule tells MicroCode to play a sound when 'A' is pressed as well. All rules run at the same time.
- when
press
button A, do
play sound emoji
happy.
The next two rules are similar but for button 'B'.
Page last edited March 08, 2024
Text editor powered by tinymce.