Microbit Workshop
Microbit Workshop
WORKSHOP
Begin your micro:bit journey
October 21 2021
Workshop Information:
Nowadays, everywhere you look are little computers that help us in our dai
ly life. Ever wonder how smartphones or fitness trackers work under the ho
od?
This workshop is great for peeking interest in STEM and teaching coding fu
ndamentals, and we start with with drag-and-drop coding the micro:bit.
The micro:bit is a small, fully programmable computer that fits in your han
ds. It has buttons, touch sensors, motion sensors and even a small screen!
During the workshop, we will build some fun and exciting apps and game
s that run on the micro:bit exposing the participants to its capabilities, teac
hing them programming skills, and inspiring them to take coding further.
The micro:bit is a great introduction to get a head start learning an increasi
ngly important skillset.
1
Material list:
For workshop giver:
- Beamer to show this presentation (notes are for presenter)
- Microbit board + usb cable
- Pc
For each participant (or per pair):
- Microbit board+ usb cable
- Pc
1
Who has a
smartphone?
Interest:
Showcase what a little wonder it is, talking to somebody at the other end o
f the world, having all books of a library in your hand, etc
Ask them if they ever had a problem with their smartphone. There will be a
few who tell their issues they have or had.
Interest:
Wouldn’t it be great to know a little bit how a smartphone works, so next t
ime it’s easier to solve these problems?
Action:
Invite them to this workshop where they will learn the basics of coding.
2
Theory:
AIDA model is a traditional communication model. AIDA is an acronym for
Attention, Interest, Desire, and Action. We are trying here to get them to ‘
buy-in’ to what we have to say. So it makes sense that we look at incorpor
ating or thinking about models such as AIDA to get our participants attenti
on. Let’s look at what AIDA is and how to use it with workshops.
Using the AIDA model will help you ensure that any kind of writing, whose
purpose is to get the reader to do something, is as effective as possible. Fir
st, it must grab the target audience's attention, and engage their interest. T
hen it must build a desire for the product offering, before setting out how
to take the action that the writer wants the audience to take.
Attention – The attention portion of the message occurs at the beginning
and is designed to give users a reason to take notice. Presenting a shockin
g fact or statistic that identifies a problem which can be solved by the prod
uct or service is one common method of gaining attention. Other methods
can include asking a thought-provoking question or using the element of s
urprise. The purpose is to give the users a reason for wanting to learn mor
e.
Interest – Once you’ve gained their attention, the next step is to maintain i
nterest and to keep the recipients engaged. Explain the problem you’ve ide
ntified in the attention step is adversely affecting how they work. A demon
stration or illustration can help the users to further identify with the proble
m and want to actively seek possible solutions. By personalizing the proble
m, you’re making it hit closer to home
Desire – In the desire stage, your objective is to show the users how to sol
ve their problem. For a compliance course demonstrate the procedure or
process to follow to ensure the meet the organizations standards or if it is
product or service explain the benefits and demonstrate how the benefits f
ulfill the need.
Action – Now that you’ve created the desire about the compliance issue/pr
oduct/service, the final step is to persuade the users to take immediate acti
on.
2
Overview
(what are we going to do today)
1 2 3 4
What is the Micro:bit? Tutorial Basic exercises Rock Paper Scissors
5 6
Friendship meter Additional exercises
3
What is the Microbit?
4
Pocket-sized computer
Learn coding
5
Features
- The interface chip handles the USB connection, and is used for flashing
new code to the micro:bit, sending and receiving serial data back and for
th to your computer.
- 25 LEDs arranged in a 5x5 grid make up the display for showing pictures
, words and numbers. They can also act as sensors, measuring how muc
h light is falling on your micro:bit.
- The micro:bit has two buttons on the front that can be used separately
or together to make things happen.
- The GPIO pins allow you to connect headphones, sense touch and add o
ther electronics to expand the possibilities of your micro:bit.
- You can power external LEDs and other electronics using the 3 volt pow
er pin.
- The GND pin is the ground or Earth pin - it's used to complete electrical
circuits when you connect headphones, LEDs or external switches to your
micro:bit.
- Restart your micro:bit programs with the reset button.
- Instead of powering your micro:bit from the USB socket, you can unplug
it from your computer and use a battery pack instead. This is really usef
ul if you want to take your micro:bit outside, wear it or play games with i
6
t. It can run for ages off two AAA batteries.
- The micro:bit's processor is its brain, fetching, decoding and carrying out
your instructions. It also contains a temperature sensor so you can meas
ure how warm your environment is.
- Find magnetic North or measure the strength of magnetic fields using th
e micro:bit's compass.
- Accelerometer measures gestures and forces in 3 dimensions.
6
First tutorial
Connect
To make your micro:bit work you need to copy your code from the editor t
o the device.
Connect your micro:bit to your computer or mobile device. You will need:
Computer - use a USB cable to connect to your micro:bit
Mobile apps - use Bluetooth to connect your micro:bit to your phone or ta
7
blet
7
Go to this website https://makecode.microbit.org/
Program
Go to https://makecode.microbit.org/ with Chrome browser and you should
see this screen
We will make a very small program first, that will display a heart on your m
icrobit!
8
https://makecode.microbit.org/
9
https://makecode.microbit.org/
Place the ‘show leds’ block in the ‘forever’ block and draw a heart.
Click Next.
10
https://makecode.microbit.org/
11
Connect
Connect
To make your micro:bit work you need to connect a micro USB cable to yo
ur micro:bit
This will supply power to function and will make it possible to transfer your
program to the board.
When you have connected it, the yellow light (led) should be on (on the ba
ckside)
12
https://makecode.microbit.org/
13
Click ‘Download’ and …
Congratulations , you programmed your microbit with your own program!.
If you think the participants can without much ‘handholding’ you can let th
em the next basic exercises.
If they need more step by step help, you could let them follow more tutori
als on the makecode website first.
14
Basic exercises
Now that you know the basics, let’s try some other programs.
Some exercises to get to know the different code blocks
Learn how to program using ‘if –then’, conditions and loops
We start simple and gradually increase complexity
15
Exercise 1:
Show your name on the Microbit
It will keep scrolling the letters of your name
Use blocks
Forever and show string
In Makecode:
Place the “show string” block in the “forever” block to repeat it. Change the
text to your name.
16
Exercise 1:
Show your name on the Microbit
It will keep scrolling the letters of your name
Use blocks
Forever and show string
Solution !
In Makecode:
Place the “show string” block in the “forever” block to repeat it. Change the
text to your name.
17
Exercise 2:
Show a flashing heart
Use blocks
Forever and show leds
In Makecode:
Place the “show leds” block in the “forever” block and draw a heart
Place another “show leds” block in the “forever” and leave blank
18
Exercise 2:
Show a flashing heart
Use blocks
Forever and show leds
Solution !
In Makecode:
Place the “show leds” block in the “forever” block and draw a heart
Place another “show leds” block in the “forever” and leave blank
19
Exercise 3:
Turn microbit into a dice
It will keep scrolling the letters of your name
Use blocks
On Shake,
Show Number
Pick random
In Makecode:
Let them try using those blocks.
20
Exercise 3:
Turn microbit into a dice
It will keep scrolling the letters of your name
Use blocks
On Shake,
Show Number
Pick random
Solution !
In Makecode:
Place the blocks as shown. Click download when finished to run on the mic
robit.
21
Rock Paper Scissors
Alternatively, let them follow the same titled tutorial on the makecode web
site.
22
Let’s make a rock, paper,
scissors game
When you shake the microbit it will display one of
the tree possibilities. Try to play with someone else!
Use blocks
On shake,
Set variable to,
Pick random,
If,
Show leds
23
Let’s make a rock, paper,
scissors game
When you shake the microbit it will display one of
the tree possibilities. Try to play with someone else!
Use blocks
On shake,
Set variable to,
Pick random,
If,
Show leds
Solution !
24
Friendship meter
Now we will make a friendship meter. The point is that we will measure ho
w much you are friends with another person!
For this, both persons need to hold hands, while one holds the GND pin a
nd the other person holds Pin 0
25
Measure how much friends you
are with one another
It will show different icons if you are best friends or
normal friends or no friends.
Use blocks
On Pin P0 pressed
Show leds
Set variable to random number
If variable > … then
else
Explanation:
When one person holds the GND pin and the other the Pin 0 and they join
hands:
we have a trigger: when Pin P0 is pressed.
At that moment the screen is temporarily blanked and a random number b
etween 0 and 100 is generated. We store that random number in a variable
that we create
If that number is bigger than 80, both participants are best friends.
If that number is bigger than 40, both participants are good friends.
If that number is bigger than 10, both participants are friendly but not goo
d friends.
Else, both participants don’t like each other.
For each of these options the icon is shown.
26
Measure how much friends you
are with one another
It will show different icons if you are best friends or
normal friends or no friends.
Use blocks
On Pin P0 pressed
Show leds
Set variable to random number
If variable > … then
else
Solution !
Explanation:
When one person holds the GND pin and the other the Pin 0 and they join
hands:
we have a trigger: when Pin P0 is pressed.
At that moment the screen is temporarily blanked and a random number b
etween 0 and 100 is generated. We store that random number in a variable
that we create
If that number is bigger than 80, both participants are best friends.
If that number is bigger than 40, both participants are good friends.
If that number is bigger than 10, both participants are friendly but not goo
d friends.
Else, both participants don’t like each other.
For each of these options the icon is shown.
27
Hot potato game
Now we will make a game where we pass around a virtual potato. There is
a timer counting down and if you have the potato when timer runs out yo
u lose!
We will be using the radio function to communicate between microbit boar
ds.
we need to model the clock as a number being tossed around with the po
tato
To keep track of things, let’s have a variable called potato:
If the value of potato is positive, the player has the potato and the potat
o variable represents the remaining time
if value of potato reaches 0, the game is over
if the value of potato is negative, this means that the player doesn’t have t
he potato in their hand
This is how will the user play the game:
press the A+B button to start the game and send the first potato
when a potato is received, the screen displays some image
when the player shakes the microbit, they send the potato to other players
28
If you keep the potato, you lose
the game
Pass the potato around while a timer counts down.
Person that is holding it when timer is up loses
Use blocks
On start
radio set group 1
Set potato (variable) to -1
On Button pressed A+B
Set potato to random 10 to 20
On Shake
If variable > 0
Radio send number
Set variable to -1
On radio received
Set variable to ReceivedNumber
Forever
If … show icon
Change variable by -1
Explanation:
Initialization
Let’s start by creating the potato variable and initializing it to -1 in on start.
Remember, a negative potato value means you don’t have the potato. We
use radio set group to make sure players receive the messages.
29
Ticking the clock
Making the clock tick down is done with a forever loop.
If the potato is equal to 0 (potato == 0), KABOOM! you lose!
If the potato variable is negative (potato < 0), we don’t have the potato so
we clear the screen.
If the potato variable is positive (potato > 0), we display a potato image an
d decrease the variable by 1.
29
If you keep the potato, you lose
the game
Pass the potato around while a timer counts down.
Person that is holding it when timer is up loses
Use blocks
On start
radio set group 1
Set potato (variable) to -1
On Button pressed A+B
Set potato to random 10 to 20
On Shake
If variable > 0
Radio send number
Set variable to -1
On radio received
Set variable to ReceivedNumber
Forever
If … show icon
Change variable by -1
Solution !
Explanation:
Initialization
Let’s start by creating the potato variable and initializing it to -1 in on start.
Remember, a negative potato value means you don’t have the potato. We
use radio set group to make sure players receive the messages.
30
Ticking the clock
Making the clock tick down is done with a forever loop.
If the potato is equal to 0 (potato == 0), KABOOM! you lose!
If the potato variable is negative (potato < 0), we don’t have the potato so
we clear the screen.
If the potato variable is positive (potato > 0), we display a potato image an
d decrease the variable by 1.
30
Egg balancing
Imagine you have an egg that is in the middle of a plate that you hold, try
not to let the egg roll of!
The plate is the 5x5 led matrix and the egg the dot in the middle.
We will use the accelerometer sensor how the microbit board is leaning (ba
ckward/forward/to the left/right). If it is, the egg will move in that direction.
When the egg falls off the game ends.
31
Balance the egg to keep it on
the plate
Use blocks
On start
variable egg
Set egg (variable) to create sprite at 2 – 2
Variabe EggIsOnPlate, default true
Variable tolerance, default 200
Forever
While EggIsOnPlate
If acceleration (mg) X > tolerance
If egg X = 4
EggIsOnPlate = False
Else Egg Change X by 1
Explanation:
Initialization
Create egg variable as a sprite with an x and y position
Create variable to flag when egg fell off the plate
Create variable for the tolerance or difficulty
In Forever loop
If you hold the plate completely level, the acceleration (mg) sensor should
be close to zero
We check for each of the 4 directions whether the readout of this sensor is
above the threshold of tolerance.
If that is the case, check if egg falls off plate, if not move the egg
Extra task
Make the game gradually harder by lowering the tolerance every 5 seconds
32
Balance the egg to
keep it on the plate
Use blocks
On start
variable egg
Set egg (variable) to create sprite at 2 – 2
Variabe EggIsOnPlate, default true
Variable tolerance, default 200
Forever
While EggIsOnPlate
If acceleration (mg) X > tolerance
If egg X = 4
EggIsOnPlate = False
Else Egg Change X by 1
Solution !
Explanation:
Initialization
Create egg variable as a sprite with an x and y position
Create variable to flag when egg fell off the plate
Create variable for the tolerance or difficulty
In Forever loop
If you hold the plate completely level, the acceleration (mg) sensor should
be close to zero
We check for each of the 4 directions whether the readout of this sensor is
above the threshold of tolerance.
If that is the case, check if egg falls off plate, if not move the egg
Extra task
Make the game gradually harder by lowering the tolerance every 5 seconds
33
Shakey donkey
Timer
game
Compass
Reaction time game
Additional
exercises
Light meter
Coin flipper
34
Thanks !
Presentation template by
All templates by PPTMON are free to use under Creative Commons License Attribution 4.0 International. That is
why the logo (lower corner right) needs to be displayed
35