> For the complete documentation index, see [llms.txt](https://sharinghub-eng.kittenbot.hk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharinghub-eng.kittenbot.hk/wifibrick_iot/makecode/makercloud.md).

# Makecode Coding and MakerCloud

![../../\_images/mcbanner.png](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mcbanner.png)

### Foreword:

In this tutorial, you will learn how to use MakerCloud platfrom with a Wifibrick or KOI. A Robotbit will be used for demonstration.

### Step 1: Platform Preparation

Log in to MakerCloud and set up an IoT service.

Navigate to the mainpage and create a project.

```
Or use ones that you created previously.
```

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc16.png)

You will be redirected to the main page of your IoT project. Select Create Topic.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc27.png)

Create a MQTT topic.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc32.png)

Navigate to the Internet of Things tab.

The topic name will be automatically generated, this topic name should remain secret as it is the key to access this topic.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc42.png)

The IoT platform is now ready to be used for IoT operations.

### Step 2: Load the extension

We will load an extension so that we can communicate with MakerCloud’s server.

Extension for Wifibrick: <https://github.com/maxwong-scale/pxt-makercloud-V2>

Extension for KOI: <https://github.com/scaleinnotech/pxt-makercloud-koi>

#### [Loading Extensions](https://kittenbothk-eng.readthedocs.io/en/latest/Makecode/powerBrickMC.html)

### Step 3: Coding

#### 1: Connecting Wifibrick to MakerCloud

Blocks for initiating connection:

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc121.png)

As a Robotbit is used in this tutorial, we initiate the Wifibrick with Tx & Rx pins.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc51.png)

Armourbit users can use ports to initialize.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc61.png)

The Micro:bit will display a short animation when connecting to the Wifi.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc16.gif)

The Micro:bit will display a short animation when connecting to the MQTT server.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc17.gif)

#### 2: Publishing to the Topic

Blocks for publishing:

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc131.png)

Let’s publish a random number to our topic.

Copy and paste your topic name here.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc71.png)

The data we sent will be shown in the real-time data feed.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc101.png)

A chart will also be generated.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc151.png)

We can manually publish data to a topic with this window.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc112.png)

#### 3: Subscribing to a Topic

Blocks for subscribing and reading data:

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc141.png)

In order to obtain data from a topic, a subscription is required.

In this example, let’s subscribe to the same topic we publish data to.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc81.png)

### Sample Program

#### Sample Program for Wifibrick

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc91.png)

[Sample Code Link](https://makecode.microbit.org/_0yhUt94oTfTD)

#### Sample Program for KOI[](https://kittenbothk-eng.readthedocs.io/en/latest/Wifibrick/MakeCode/makercloud.html#sample-program-for-koi)

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mc181.png)

[Sample Code Link](https://makecode.microbit.org/_2FfTJ1eMaKtV)

### Conclusion:

This concludes the basic usage of the MakerCloud platform with a Micro:bit, for more advanced usage, please refer to the official tutorials.

### 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](https://kittenbothk-eng.readthedocs.io/en/latest/Makecode/makecode_extensionUpdate.html)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sharinghub-eng.kittenbot.hk/wifibrick_iot/makecode/makercloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
