Makecode Coding and MakerCloud
Last updated
Last updated
In this tutorial, you will learn how to use MakerCloud platfrom with a Wifibrick or KOI. A Robotbit will be used for demonstration.
Log in to MakerCloud and set up an IoT service.
Navigate to the mainpage and create a project.
You will be redirected to the main page of your IoT project. Select Create Topic.
Create a MQTT topic.
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.
The IoT platform is now ready to be used for IoT operations.
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
Blocks for initiating connection:
As a Robotbit is used in this tutorial, we initiate the Wifibrick with Tx & Rx pins.
Armourbit users can use ports to initialize.
The Micro:bit will display a short animation when connecting to the Wifi.
The Micro:bit will display a short animation when connecting to the MQTT server.
Blocks for publishing:
Let’s publish a random number to our topic.
Copy and paste your topic name here.
The data we sent will be shown in the real-time data feed.
A chart will also be generated.
We can manually publish data to a topic with this window.
Blocks for subscribing and reading data:
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.
This concludes the basic usage of the MakerCloud platform with a Micro:bit, for more advanced usage, please refer to the official tutorials.
There may be updates to extensions periodically, please refer to the following link to update/downgrade your extension.