Micobit-Smart City Kit
Lecture 8
Topics
• Connecting and programming Micro:Bit
• Introduction to Smart City IoT starter kit
• Introduction to IoTbit
• Connecting MicroBit with IoTbit
• Programming Smart City kits
• Explore Thingspeak cloud
• Exploring applications
Plug in the Microbit
• Connect your micro:bit to your computer.
• If you're using a computer, you need a micro USB cable to connect to
your micro:bit to your computer's USB socket
• Explore the features.
Step 1
• Go to MakeCode, create a new project
Step 2
• Create a [+new project] in MakeCode. Give the project a name. This
will take them to the coding software.
Step 3
• Explore the coding software
Example: flashing heart
Interactive
programming
examples
Interactive programming examples
Answer the following
• What is displayed when the micro:bit is switched on?
________________
• What is displayed when button A is pressed
• (a) the first time? ________________
• (b) the second time? ________________
• (c) the third time? ________________
• (d) the fourth time? ________________
Lets try loop functions
Answer the following
• What numbers are shown when the following button sequence is pressed after switching
on the micro:bit? (In some parts, more than one number is shown.)
• (a) A ________________________________________________________________
• (b) B ________________________________________________________________
• (c) A, A ______________________________________________________________
• (d) A, A, B ____________________________________________________________
• Use a mathematical expression, in terms of a and b (values stored in variables a and b),
to express the number shown when
• (a) Button A is pressed: __________________________________________________
• (b) Button B is pressed: __________________________________________________
Functions
*121 as secret and 1 as number is also
good!
TIP: Show number
Answer the following
• What is the value of number when the micro:bit is switched on?
________________
• What is the value of number when the following button sequence is pressed after
switching on the micro:bit?
• (a) A ________________
• (b) B ________________
• (c) A, A ________________
• (d) A, B ________________
• (e) B, A ________________
• (f) B, B ________________
• (g) A, A, B ________________
• (h) B, B, A ________________
Smarthon Smart City IoT Starter kit
Introduction
• Designed to introduce Internet of things (IoT)
• With basic knowledge of computing knowledge and electronics provided in
the kit, you can be a city creator and build a unique IoT system in the city.
• Based on Smarthon IoT board, which is compatible with multiple
sensors and actuators, you can design city features;
• for example: using sensors to detect traffic status and upload city information
to the internet.
Application Scene
• Automated Playground Lamp
Application Scene
• Smart Car park Access Barrier
Software support
MakeCode editor
• The MakeCode editor is the official cross-platform editor designed for
BBC Micro:bit, it is available on Web Browser, Mobile and tablets
Apps.
• The Colorful coding block is familiar to Scratch, providing a simple and clear
way to programming on the Micro:bit.
• The editor offer a text-based mode for user to programming using
JavaScript rather than drag the blocks
https://makecode.microbit.org/v6.0.17#
Python editor
• Python is one of the most famous programming language, widely
used in school and industry.
• Micro:bit provided an online python editor for user to study and
exercise python on Micro:bit.
• User just need to connect Micro:bit with USB and click the Flash
button, the compile and upload progress will be finish automatically.
First watch the following: https://youtu.be/mREwMW69qKc
https://python.microbit.org/v/beta