Micro:bit Introduction – Microcontrollers | Part 1

micro:bit introduction lesson

A microcontroller (MCU – microcontroller unit) is actually a chip design to perform some operations according to the given instructions. It is a small computer on a single IC (integrated circuit). A microcontroller consists of four basic components. In this tutorial, you will learn, how to use micro:bit. (Micro:bit Introduction lesson)

  1. Central Processing Unit (CPU) – It takes instructions from a program and performs a calculation.
  2. Memory – It is used to store data. Memory is the storage space in the device.
  3. System Clock – It is an electronic device. It synchronizes all components.
  4. Peripheral devices – Small pins used to input data or output information. Data is collected in both analog and digital forms. The output is released in digital form.

A few such micro controller based kits are shown below,

  • micro:bit, Arduino, Raspberry pi, Sphero, BlueBot

Micro:bit Introduction Lesson

The micro:bit (BBC Micro Bit) Hardware is based on ARM-based embedded system. It designed by the BBC (British Broadcasting Corporation) for use in Computer education. It’s a single-board microcontroller. This board has the basic features of a computer. Further, it contains sensors also.


How to Buy Micro:bit Module

Cost
BBC micro:bit Go Bundle – USD 17 – USD 20

Go Bundle contains:
BBC micro:bit
Micro USB cable, 6″ end-to-end
2 x AAA battery holder
2 x AAA battery

Product Dimensions: 52.0mm x 43.0mm x 11.0mm / 2.0″ x 1.7″ x 0.4″
Product Weight: 9.0g / 0.3oz

Get Micro:bit – https://microbit.org/resellers/
Accessory Guide – https://microbit.org/assets/documents/AccessoryGuide.pdf

micro:bit introduction lesson
Front view of the micro:bit module

(1) – Two programmable buttons (A and B)
(2) – Programmable LED bulbs (25 lights)
(3) – Analog and digital input/output pins (3 pins)
(4) – Power pin
(5) – Ground pin

micro:bit introduction lesson
Back view of the micro:bit module

(6) – Central Processing Unit (CPU)
(7) – A micro USB port to connect to a computer
(8) – Bluetooth and radio antenna to connect a device using Bluetooth.
(9) – The battery connector to connect a 3V power supply
(10) – Accelerometer
(11) – Compass
(12) – Reset button

Connecting micro:bit module to the computer

Connect the small end of the USB to the micro USB port on your micro:bit. Then connect the other end of the cable to a USB port on your computer. On computer, micro:bit appears as a drive.

micro:bit introduction lesson
https://support.microbit.org/ (images and Details) 

Coding the micro:bit module

You can use any editor for coding. In this tutorial, I will use MakeCode online editor. Coding can be easily done by connecting blocks. Or you can use programming languages like JavaScripts, Python, etc.

micro:bit introduction lesson

Other editors: https://microbit.org/code/

How to be a Programmer

Micro:bit Introduction Lesson – Basic Block

micro:bit introduction lesson
on start – Primary actions included here
micro:bit introduction lesson
forever – Repetitive tasks are included here

To get more block types, click on the menu in block editor

#show number –To display a number

micro:bit introduction lesson

Simulater – https://makecode.microbit.org/_P8hXHV0ViRzF

#show leds –To create LED patterns

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_emwTT29V7Lds

#show icon –To select pre-made LED patterns

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_eKVa4k1KR4F7

#show strings –To display text

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_A1v61EcHUAh9

#pause (ms) –To give an interval in ms (milliseconds) for an action

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_4vM0DYg9EDFf

#show arrow – To display arrow icons

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_HvkDLLbHgcW3

#clear screen – To clear display data

Micro:bit Introduction Lesson – Input Block

#on button {A, B, Both} pressed – To specify actions for button A, B and Both

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_hd91CvX67YhD

#on pin {P0, P1, P2} pressed – To specify actions for pins P0, P1, and P2 (while also touching the GND pin)

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_FwDgtjd23WJa

#on {actions} – To specify actions for shaking, motion, free fall or etc…

micro:bit introduction lesson

{actions} – shake, logo up, logo down, screen up, screen down, tilt left, tilt right, free fall, 3g, 6g and 8g

Simulation – https://makecode.microbit.org/_9uV3brT1VibR

#acceleration (mg) {x, y, x, strength} – Get the acceleration value in milli-g (flat surface — x=0, y=0)

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_f2uDLuDsj7fj

#light level – Reads the light level applied to the LED screen (0 – 255)

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_Akp4Ca8fo29o

#compass heading (o) – Get the current compass heading

micro:bit introduction lesson

Rotate the micro:bot logo, for change compass heading

Simulation – https://makecode.microbit.org/_6i7i63V0UVFD

#temperature (oC) – Gets the current temperature

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_5sWKR755U3ag

#button {A, B, Both} is pressed – Get the button state (pressed or not) for buttons.

#pin {P0, P1, P2} is pressed – Get the pin state (pressed or not) (requires to touch GND pin to complete circuit)

Micro:bit Introduction Lesson – Loops Block

#repeat {count} times- Do some statement several times

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_5zt1a6Rs21Jd

#while {condition} – Run the same block of action while the condition is true

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_8f1HRpVPvbt9

#for – Have the variable “index” take on the values from “0” to the end number(“4”). Counting by 1, and do the same block of action.

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_PPbdWeTuhcD0

#for element – Have the variable “value” take the values of each item in the array. And do the same block of action.

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_DCLC0JiCC52m

Micro:bit Introduction Lesson – Logic Block

Check this :

How to be a Programmer | Part 4 : Control Structures

#if-else – if a condition is true, run the block of code.

Adjust temperature for check code

micro:bit introduction lesson

if you want to add more condition, click the plus icon

Simulation – https://makecode.microbit.org/_YtoL18gaYLru

Press A button (Don’t release button)

micro:bit introduction lesson

Simulation – https://makecode.microbit.org/_caVK8aUAxeWc

Download above Micro:bit .HEX file: Drive link

For more information, visit http://microbit.org/

Sources: 
https://pixabay.com (Images)
https://support.microbit.org/ (images and Details)
https://makecode.microbit.org/ (Coding Simulator)
https://www.draw.io/ (Charts)

Hi Friends,

Hope this post (Microcontrollers | Part 1 – Micro:bit Introduction lesson) will help you to learn something. If you enjoy my work, please Share my posts with your friends and anyone who might be interested in programming. Don’t forget to Comment and, Subscribe.

What do you think about Micro:bit?
See you in the comment section.

Like ctechf Facebook fan page : https://www.facebook.com/ctechf

Also Read :

How to be a Programmer

Leave a Reply

107 Shares
Share
Tweet
Share
Pin
Share