Makecode Coding and ObjectBlocks

Foreword

The following tutorial is for WifiBrick and Robotbit, for KOI users, some programs may need adjustments to work on KOI.

1: Setting Up ObjectBlocks

Create an account on ObjectBlocks.

ObjectBlocks

Log in and create a new project.

../../_images/object1.png

../../_images/object2.png

Select Channels from the menu.

../../_images/object3.png

Add a new channel.

../../_images/object4.png

Specify the type to be either text or numeric.

Remember to choose YES for the webhook option.

../../_images/object5.png

../../_images/object6.png

The webhook option contains credentials for accessing your channel, please keep confidential.

../../_images/object7.png

Publishing and subscribing to the channels requires credentials.

../../_images/object8.png

In order to visualize the data on ObjectBlocks, we need to create a dashboard. Add a new dashboard via the menu.

../../_images/object9.png

../../_images/object10.png

Add a tool.

../../_images/object11.png

Many kinds of representations are available, for this tutorial, text will be used.

../../_images/object12.png

Select the channel we’ve just created.

../../_images/object13.png

2. MakeCode Coding

../../_images/mcbanner.png

Import WifiBrick Extension

Search for Kittenbot and import KittenWifi.

../../_images/object14.png

For KOI user, import KOI.

1: Connecting to ObjectBlocks platform.

Fill in the authentication credentials for ObjectBlocks.

MQTT Host: hub2.objectblocks.cc Node: Does not matter Username: Your username(Host) Password: Your password(Pass)

../../_images/object15.png

2: Publishing to ObjectBlocks

Copy and paste your ObjectBlocks topic into the publishing block.

../../_images/object16.png

3: Subscribing to ObjectBlocks

Copy and paste your ObjectBlocks topic into the subscribing block.

../../_images/object19.png

4. Final Program

Press A to publish a random number to ObjectBlocks, the number is shown on the Dashboard as well as the Micro:bit.

../../_images/object21.png

Sample Program

../../_images/object20.png

Sample Program

Extension Version and Updates

There may be updates to extensions periodically, please refer to the following link to update/downgrade your extension.

Makecode Extension Update