1. Lesson 1

../_images/1_1.jpg

1.1. Introduction

Welcome to the Micro: bit Smart Car Tutorial!In this course, we will explore the Micro: bit and learn how to control the Micro: bit car in programming.

1.2. Teaching Objectives

Let students master different Micro: bit SMART CAR’s parts and their functions,And learn about the various block coding features.

1.3. Understand micro: bit expansion Circuit Board

../_images/1_2.png

1.4. Understand the Mecanum Wheel Car

  • 4 Motors

  • 4 Mecanum Wheels

  • Micro bit

  • Micro bit Expansion Circuit Board

../_images/1_3.jpg

  • Ultrasonic Sensor

../_images/1_4.png ../_images/1_5.png

  • Infrared Line Follower

../_images/1_6.png ../_images/1_7.png

1.4.1. Preparing Micro: bit Programming Software Makecode

Online Programming: https://makecode.microbit.org/

../_images/1_8.png

Install on mobile device: Android

../_images/1_9.png

Install on mobile device: Apple iOS

../_images/1_10.png

1.4.2. New Extensions

Step 1: Choose Extensions on Advanced category.

../_images/1_11.png

Step 2: Put this link to the yellow box as shown below https://github.com/stemhub/pxt-Stemhubbit

../_images/1_12.png

step 3: Adding extansions into makecode

../_images/1_13.png

1.4.3. Connect micro: bit to the computer

1) Connect the micro: bit to your computer with a USB cable, then press “Pair device”

../_images/1_14.png

2) Choose micro: bit’s port and connect it

../_images/1_15.png

3)”Connected to micro: bit” will be shown when finished

../_images/1_16.png

1.4.4. Save program file(.hex) to micro: bit

1) After finished the above process successfully,click download or save program file(.hex)

../_images/1_17.png

2) After connecting micro: bit to the computer with the USB, you will able to find MICROBIT device, and move the file to MICROBIT device.

../_images/1_18.png

3) After moving the file to MICROBIT device.

MICROBIT device may disappear for a few second and appears again later. when the device appears again, you can disconnect the USB cable. 

1.5. understand Block Programming

1.5.1. PAUSE Block module:

It can control how long the program execute,

PAUSE Block module can be found in "Basic" category

The waiting time can be set by the number in yellow box.

1000 millisecond = 1 second

../_images/1_20.png ../_images/1_19.png

1.5.2. IF Logic Block Module:

It is put into "Logic” category

The condition can be put after the word “if”.

Command to be execute can be put into the IF block module.

../_images/1_22.png ../_images/1_21.png

The plus sign in the bottom left corner can used to attach some additional condition:

  • “else if” can be used to set additional condition

  • “else“ is used to set the action to be taken when condition of both “if” and “else if” did not fulfilled.

../_images/1_23.png

1.5.3. Comparison block module:

In “Logic” category,

../_images/1_25.png ../_images/1_24.png

you can put numbers into this type of block and choose the comparing condition like equal (=) 、not equal (≠) 、less than (<) 、less than or equal to (≤) 、greater than (>) 、greater than or equal to (≥)

1.5.4. Mathematical operation block module:

Basic Mathematical operation,addition (+) 、subtraction (-) 、multiplication (×) 、division (÷) 、square (**)

../_images/1_27.png ../_images/1_26.png

1.5.5. ”AND,OR” block module

‘AND’: Execute when both condition before and after ‘and’ are fulfilled

‘OR’: Execute when one or more condition before or after ‘or’ are fulfilled

../_images/1_28.png ../_images/1_29.png

Table for “AND” and “OR” operation

A B A AND B A OR B
False False False False
False True False True
True False False True
True True True True

1.5.6. ” Variable”

Variable used to record data

Variable can be set as value, binary number or event variable which can be establish in ‘Make a variable’

../_images/1_30.png ../_images/1_31.png ../_images/1_32.png

After established a new variable, there will have three block modules can be used

../_images/1_33.png

This block call variable

../_images/1_34.png

This block initializes the data stored in the variable

../_images/1_35.png

This Block add the numbers in the white box to the variable.