· web viewsome of the items in the toolbox have more than one menu of choices. the `basic’ tool...

4
PROM: Primary Robotics On Micro:bits Adrian Oldknow [email protected] March 2018 Section 1: Using the Microsoft MakeCode editor Open the Microsoft MakeCode home page: https://makecode.com/ . Have a good look down this page and explore some of the other pages on this site. From the Home page select the `Code’ button for micro:bit. This takes you to the MakeCode block editor. There is a helpful guide in the blog . At the top of the screen, in the blue area, there is the `Menu bar’. At the left there is the `micro:bit simulator’. In the centre there is the `toolbox’ with coloured writing and images. On the right there is the `editor’ where you build up your code. At the bottom is a `Toolbar’. Pressing the `Getting Started’ tab runs a tutorial. When you start a new program, two blue blocks appear in the editor. We won’t need either of these in this first activity. In order to delete something from the editor, just drag it into the toolbox area, which changes to show a trash can. Release the mouse button to delete the block. Repeat the process to delete the second

Upload: others

Post on 25-Feb-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1:  · Web viewSome of the items in the toolbox have more than one menu of choices. The `Basic’ tool has a `More’ option. Create a third program in the editor to clear the screen

PROM: Primary Robotics On Micro:bits Adrian Oldknow [email protected] March 2018

Section 1: Using the Microsoft MakeCode editor

Open the Microsoft MakeCode home page: https://makecode.com/.

Have a good look down this page and explore some of the other pages on this site. From the Home page select the `Code’ button for micro:bit. This takes you to the MakeCode block editor. There is a helpful guide in the blog. At the top of the screen, in the blue area, there is the `Menu bar’. At the left there is the `micro:bit simulator’. In the centre there is the `toolbox’ with coloured writing and images. On the right there is the `editor’ where you build up your code. At the bottom is a `Toolbar’. Pressing the `Getting Started’ tab runs a tutorial.

When you start a new program, two blue blocks appear in the editor. We won’t need either of these in this first activity. In order to delete something from the editor, just drag it into the toolbox area, which changes to show a trash can. Release the mouse button to delete the block. Repeat the process to delete the second block. We are going to make the micro:bit respond to different kinds of inputs. The simplest of these uses one or other of the A or B buttons. Select `Input’ from the toolbox to open up a menu of choices. Drag the `on button’ block into the editor. Now select `Basic’ and drag the `show icon’ block into the editor. Put it in the jaws of `on button’. Click on the little arrow at the side of the icon and choose a pattern you fancy, like a `diamond’.

Page 2:  · Web viewSome of the items in the toolbox have more than one menu of choices. The `Basic’ tool has a `More’ option. Create a third program in the editor to clear the screen

Now you have created your first program. Press button A on the simulator and check that it works.

Now create a second program in the editor to display a different pattern when button B is pressed. There isn’t a separate `on button B’ block in the `Input’ toolbox, but there is a little arrow next to `A’ in the `on button A’ block which allows you to create your own block for button B.

Some of the items in the toolbox have more than one menu of choices. The `Basic’ tool has a `More’ option. Create a third program in the editor to clear the screen when both buttons A and B are pressed.

Now you have created a program for the micro:bit which responds in different ways depending on which combination of buttons is pressed.

Next we need to find out how to save our work and maybe share it with others. Use the block in the middle of the toolbar to enter a title for your program.

If you want to keep a record of your work you can use the `Ctrl’ and `PrtSc’ keys to take a screenshot which you can paste into Word, and then `Crop’. That’s the way I have created the images above. Click on the `Projects’ tab in the Menu bar. You should now see that your program title now appears. It is automatically filed for you somewhere `in the cloud’. If you want to access your work from a different computer you will need to create a link which you can use to retrieve it. Close the `Projects’ page and find the symbol for sharing to the right of the `Projects’ tab.

This asks to you to confirm that you want to publish your work. If you accept, then it provides you with a link which you can use to access your own file, or to send to anyone you want to share it with.

When you open the link in a browser you see a different sort of display which shows your blocks and allows you simulate the program, but if you want to edit the program you need to press the red `Edit’ button, which opens up the familiar MakeCode editor display once more.

Page 3:  · Web viewSome of the items in the toolbox have more than one menu of choices. The `Basic’ tool has a `More’ option. Create a third program in the editor to clear the screen

So far we have used MakeCode’s `Blocks’ editor which works in much the same way as the Scratch programming language. But you can also switch into the `JavaScript’ programming mode which shows the text version of the same program. This also has help features to tell you about the available options.

Finally return to the `Blocks’ mode and explore the options available from the `on shake’ block in the `Input’ menu. Explore what the options mean and use some of them to create other programs.