Micro:bit “Hello World”

If you have used MakeCode with the Circuit Playground Express, switching over to the Micro:bit will be a breeze! They are pretty much programmed the same way, and you transfer your code to the Micro:bit just like you do with the CPX. In this Recipe we will play with the Micro:bit, focusing on a few of the differences in its capabilities, notably its display and radio features – both of which are very useful for many project ideas your student will come up with!

Ingredients

 

Directions

  1. Go to makecode.microbit.org and create a new project. At the bottom of the screen, name the project “Hello Radio” and click the save icon.
  2. From the “Input” set of blocks, drag an on button A pressed event out.
  3. From the “Basic” set, drag a show string block out and place it inside the event block. Change the string to “Hello World”. Test the button on the simulator, then download and move the file to the Micro:bit board to test it there.Hello_Radio_-_makecode_microbit_org.png
  4. Now create a second event so that when the B button is pressed you get the message “Goodbye!”. Test on the simulator.
  5. Now we are going to add the radio function. You will need to work together with a partner for this one.  From the “Radio” blocks, take a radio set group block and place it in the on start event. If you are doing this with only one other person, you can leave the group as 1 but if you are doing this with a class with multiple teams then each team should use a different number.
  6. Make the changes and add new radio blocks as shown below so that the A and B buttons send messages with your name to any other Micro:bits in your group, and when you receive a message it displays it. Hello_Radio_-_makecode_microbit_org.png
  7. Download the code and test it with your friend. See if you can send messages to each other!

 

Hello World Garnishes

  • Icons! They are easy to select or make yourself using the show leds and show icon blocks in the “Basic” tools.
  • Can you change your radio program above to send icons to your friend? How about creating a game (like rock, paper, scissors) that you can play with two Micro:bits? A coin flipper? A reaction time game? If you need help or ideas, there are some amazing projects laid out at https://makecode.microbit.org/projects

Leave a comment

Mintz Family iLab Project Blog

Things I've made and helped others make. Stories about creating and messing up.

Kris Swanson dot Blog

Things I've made and helped others make. Stories about creating and messing up.