[Music]
hello and welcome to our BBC microbic
Global codal my name is Giles and my
name is blaed and we are part of the
Education team here at the microbit
Educational Foundation now does anyone
know the theme of today's Cod along here
are a few
Clues there a butterfly
F uh oh okay that looks like some
flowers well that's definitely a
tree oh my goodness a very large Robin a
very large
bird so well done anyone watching if you
have shouted out the theme is
biodiversity happy International Day for
biological diversity um or International
Day for bio biodiversity as it can be
shortened to the United Nations theme uh
this year is all about building back
biodiversity because we all depend on a
wide variety of plants and animals and
microorganisms to keep us all healthy
and thriving so in today's codal along
you are going to be doing your bit as
well because you are going to be
building back bio biodiversity too by
creating a bi biodiversity counter that
can be used in your school playground or
any other outdoor area you have near
your school and as today is UN day for
biodiversity the plan is to create uh
the project in the make code editor but
then to transfer the code onto the
microbit and use them outside to count
the number of species of animals and
species of plants that you can spot you
don't need a microbit to take part in
this session as we will be making good
use of the simulator on make code
website but if you do have microbits
then make sure you have them out ready
to put the code on at the end of the
session and in today's session we're
going to be coding along together make
sure that you pause the video whenever
you need to and you can replay parts
that you need to hear over again I'm
really excited that we're coding the
biodiversity cter together so students
all over the world can see what their
local biodiversity is like if you have a
school Twitter or X account then make
sure you share how you get on you can
tag us we are at microbit uncore edu
that's microbit uncore edu on Twitter or
X that's a really good idea J it will be
lovely to see how different classes and
schools get on in their environments so
I think we're ready to get started Giles
can you think of anything else we need
to mention before we start coding I
think as we're making a species counter
I think it would be really good just to
make sure that everyone knows exactly
what a species is great call Giles okay
so a species is a set of animals or
plants who have similar characteristics
to each other so they all look similar
to each other and they have similar
characteristics so for
example let's look at these pictures
here so let me just remove this so that
you can see it better there we go so so
um in the in the slide here we've got
lots of different animals but how many
species have we got Giles oh that's a
really interesting question it's quite
tricky actually um I'm going to start
with the ones that all look the same so
I can see some snails there um some in
their shells some out of their shells so
I think the three pictures of snails
that's one
species um I can see Robin again a bird
and I don't see any other birds on there
so I think that's probably another
species um we've got oh two butterflies
so I think two butterflies uh probably
one more species and then I can see a
fly and I can see a worms so I think
have we got five species there blonded
well done yes I think that is spot on
and that means that everyone is very
clear and everyone can be super accurate
when they go out and they start logging
their species later thanks chares so
let's get coding um so the what we're
going to do is we're going to bring you
to the makecode editor
website so um you'll find that you can
see it on the banner now at make code.
microbit
you can get started with right away
without needing any logins or passwords
and so on so there is a sign-in button
on the top right so schools with
Microsoft or Google logins can use that
but we don't need to we can jump
straight in um now I've got some
projects showing here because I've used
it before if it's your first time you
might not have that but you will have
new project the new project button and
that's what we're going to jump straight
into also in the settings on make code
in the top right there's a little Cog
here next to the sign-in button that's
where you'll find different languages if
you want to change the language to to
your local language so click on new
project and the first thing it does is
asks me to give it a name so if you're
doing the same project as the CL it's a
really good idea to make sure that your
name or your student name is is is
included in the project name and today
we're making a biodiversity counter so
I'm going to name my project blana
biodiversity counter and click on
create okay so this has opened up the
make code editor so we can see that
there's some blocks of code already in
the workspace here on the right now I'm
going to make that a little bit bigger
by using this plus sign in the bottom
right hand side going to zoom in on my
blocks of code a little bit do you think
that's large enough Giles I think so I
can see that really clearly thank you
blet okay brilliant so um this is the
workspace this is where you can draw
drag blocks of codee around and you drag
them in from the toolbox over here and
you build your code in this space now we
won't need the forever block for our
project today so I'm actually going to
show you how to delete the blocks as
well by dragging them onto the uh the
the menu here or the toolbox and then
just letting go and it will delete a
block um when you have a look inside
this menu you can see that there's lots
of pre-prepared blocks of code ready to
go you don't need to have to know what
to type like you would in a text based
um editor you can just take the blocks
and you can drag and drop them onto the
workspace as you need
them um on the left hand side here we've
also got the simulator so we'll be using
this today to check that everything is
working before we put our code on our
microbit and take them outside to do our
biodiversity logging um we'll also be
using the download button we just take
off the banner for a second perfect
thank you Giles so the download button
here bottom left that will be used at
the end of the session so that we uh can
put our code onto our microbit so we
will if I just show you on my screen let
me get a view of me on the screen
second so on the microbit here we will
use the USB lead we will plug that into
our computer and we'll plug the other
end into our microbit and we will press
download and we will put the code on the
microbit and then attach the battery
pack so that we can bring it outside
into the environment and uh code and use
the code we have created that way okay
so coming back to our project that we're
going to create today um I'm going to
stop here and have a little think about
what my program is going to do I want to
use my microbit in the playground ler to
count two different things the number of
animal species and the number of plant
species species I want the microbit to
count for me and remember how many of
these species I spotted because there's
absolutely no way I'm going to keep all
that information in my head so I want
the microbit to remember the information
or the data so that means I need to
create two different variables so in the
toolbox here we've got variables as a
red menu section of the menu so if I
click on variables you'll see it gives
me one option right now and that is to
make a variable able so variables are
like containers they will hold different
pieces of information and they will keep
updating as we use the microbit and add
more
information so the two uh variables I
want to create today are I click on make
a variable and then I name them so I'm
going to call my first one animal
species and click okay and then I'm
going to oh you see straight away some
Co some blocks of code have appeared
because I've created this variable so
we've got some other blocks of code here
we can use later and then I click on
make a variable again and I'm going to
call this plant
species and click on okay so now I've
got options to use these blocks of code
to change it from animal to plant when I
need it and I've made my two variables
if I go back into variables here I can
see them sitting here animal species and
plant
species okay so let me just delete that
properly there we go
so everyone approaches coding a little
bit differently and sometimes there are
different ways to achieve the same
things so Giles what would you do next
now that we've created the variables
well I was just thinking about that when
I turn on my mic a bit and the program
starts I won't have counted any Vari I
won't have counted any animal species or
plant species yet so I'm thinking
whether it's a good idea to set both
variables to zero so what I might do is
I might go into the variables
menu and take set plant species to zero
and drag that into the on block anything
you put in the onstart block will um the
microbit will carry out that instruction
when the program starts running so it's
going to set the zero uh set the plant
species to zero at the start of the
program then I drag the same block again
so I go back into variables and drag out
set plant species to zero again but I'm
going to change maybe plant species to
animal
species so we have plant species and
animal species both set to zero at the
start of the program do you think that's
a good idea blet yes definitely I would
I would have done the same thing at this
point for sure to make sure that the
microbit knows to start counting from
zero for each of those variables there's
one other thing I do as well um there's
nothing on the screen of the microbit
when you turn on at the moment and I
think it would be useful to also show a
zero on the screen so I'm going to add
in that instruction I'm going to go into
the basic menu so the menus are all
colorcoded and blue blocks are from the
basic menu I'm going to take the first
one here show number and I'm going to
drag that in to the onart block here
it's already got the number zero in it
and now you can see the simulator has
updated and when my mic bit starts it
will show a zero on the screen as well
okay so let's have a quick recap to to
make sure that everyone is keeping up
when they're coding along in their
classrooms so have you made your
variables remember we went into
variables we clicked make a variable and
we made two one called animal species
and one called plant species okay have
you set your variables to zero we took
out this one set plant species to zero
and we used it
twice but we changed it using the drop
down menu from plant species to animal
species and we popped that into the
onstart block and then we added a zero
through using the show Number Block here
in the basic menu as well okay
so that
means we have got started but there's
two very important things that we need
to do next and they're both to do with
using the buttons on the microbit
because we're going to be using both
button a and button B uh that are on the
front of the microbit so we're going to
use one button to log data about animal
species and we're going to use another
button to log the data about plant
species so let's start with button a
here are a few
clues for what we're going to
use button a for any
ideas well um let me see we had uh a
butterfly we've had uh a bird and a
snail so I think a is going to be for
Animals correct yes A is for Animals is
animals that's easy to remember yes so
all the pictures are animals so button a
is going to lck the animal species so to
make something happen on the micob bit
when we press button a we will need the
on button a press block so you'll find
this in a new menu the the purple
purpley pink menu here called
if I go into that menu the very first
block is on button a press so let's pull
that out and put that into the
workspace okay so we want the animal
species uh variable to update by one
each time we press button a so that
means I need to go back into my
variables menu in here and I I'm looking
at the second block here I want to
change something by one when I press
button a now when I pull this out just
pop it there for a moment it it goes
this strange color because it's not
inside uh a working block at the moment
but I can still manipulate it here I can
still change it to what I want so I
actually want to change the animal
species on but a so I'm going to switch
that to animal species and I pop it
inside the on button a pressed block so
that means that the microbit will update
the total number of animal
species each time we press button a uh
on the micro bit
itself okay Planet I I got a question
here I I've been following along I've
got the same blocks as you but when I
press button a I just get zero on the
screen even though I keep pressing
button a have I done something wrong not
at all Giles um
I I have the same thing happening on my
mic bit on here so I might be pressing
on my simulator I might press butt a a
couple of times but my screen has not
changed so you have not done anything
wrong you just have not given the
microbit the instructions to do that
part yet okay the micr will only do what
you ask it to do if we want to see the
total on the LED display then we need to
put those instructions in and ask the
microbit to show it to us so let's add a
few more blocks to make that
happen so if we go into to um what are
we going to go we're going to go into
into basic first of all and we're going
to scroll down to the show icon block
okay so this will help us know that when
it shows us data on the LED display it's
talking about animal species data so I'm
going to pop that in here and I'm going
to change the icon from a heart to
something that resembles an animal
species so let's have a look got lots of
pre-prepared icons here right I'm going
to choose the duck so we've got a little
duck icon to to stand for our animal
species right um the next thing I'm
going to do is I'm going to go back into
basic and I'm going to take the show
number block again and I'm going to pop
it in below now this time I don't want
to the show Number Block to show us zero
I want it to show the total number of
animal species on the LED display so
I've got to go back into variables and
find my animal species block the small
one here so I take this out and you can
see how it can slot in over the zero and
replace it so we do that and then our
code will
update okay so now if we test if it's
working on the simulator it should work
this time but actually I've got an idea
to test that Giles so do you remember
this this slide that we looked at
earlier oh yeah was it again how many
times I press a if these were the
animals I'd seen outside oh gosh right
I'm trying to remember again we had
snails and uh that was one species and
then we had two butterflies but that's
only one more species because they're
both both the same species so that's one
more uh we had a bird and we've got a
fly and I've got a worm so I think it
was five different animal species that
we have there correct well done J yes so
on my simulator now I am going to press
a five times and let's see if we can see
something happening and
see yes there we go one two 3
4 five so we've now given the correct
instructions yeah so we can see now that
when we log one it will give us some
feedback on the LED display to know that
it's happened um so if everyone has got
this part coded then that means we are
halfway there
yay
fantastic fantastic so we're halfway
there um and we've told the microb bit
what to do when we press button a when
we're counting animal species but we
haven't yet told it what to do when we
press button B now I wonder if anyone
can remember what are we going to count
when we press but button B can anyone
remember that
I ah right so we've got uh some flowers
we've got a
tree um oh and some more plants oh is it
plant species
Jiles might be plant species that we're
getting when we press button
D so what we want to do is we want to
use button B to to log plant species so
what we can do now is we can dup at or
copy the blocks that we have for button
a I wonder bled could you show us how to
do
that what do you can you just tell us
what you're doing there to get that that
menu to pop up yeah so I've put my
cursor over the entire block on button a
pressed and then I've right clicked and
then I get the menu at duplicate at the
top so you can duplicate that's one way
of doing it or you can just fetch the
blocks again uh from the toolbox in the
middle but just because it's quicker and
easier we're going to show you uh how to
duplicate so if you click on that and
duplicate the block you'll see again
like a bit like it did before the blocks
have gone a funny color uh and that's
because we've got two on button a press
blocks and we can only have one uh set
of instructions for what to do when you
press button a otherwise the microbit
will get really confused so first thing
we need to do is to change button a to
button B okay and then because we're not
counting animal species anymore we need
to change animal species to plant
species and I think it would be a good
idea to show a different picture at this
point not a duck so we'll pick something
else so if you click on that have a look
and pick something there is I think
there's a fork icon that looks a little
bit like a tree that's it that one we
can pick that you can also draw your own
plant icon as well if you like you can
use the show LEDs Block in the basic
category and you can draw your own
picture of an animal or a plant but
we're just going to pick the the fork
icon because it looks a bit like a tree
uh and then I think there's one more
thing we need to change yeah well
spotted bled because at the moment the
code is going to show the animal species
number when we press button B and that
would be wrong so we need to click on
the little arrow on that and change that
to plant
species
perfect thank you Giles I think that's
looking like it should work really well
and we should be able to test out button
B on the simulator now as well um so if
I was outside and these were all the
plants I saw while I was in my
playground how many plant species would
I log how many times do I press button B
oh that's a good question because I can
see lots of flowers there so I might
want to keep clicking uh and click lots
of flowers but I need to think I need to
be really careful about this I think
there are only two species here because
I've got flowers like daisies they look
the same so although there's lots of FL
flowers there that's only one species
that I've spotted and then there's some
Ivy some leaves growing in the middle so
I think here if I saw that when I went
outside I would log two plant species I
would press button B twice fantastic
that is very accurate and correct so I'm
going to do button B twice now on my
simulator and there we go we can see the
plant icon came up and the number came
up each time as well which is exactly
what we've asked it to do using the code
so that's that's fantastic Planet that's
really good but the number just flashes
up what if I can't remember the number
of animal species and plant species is
there a way we can get to see the the
sort of running total without having to
add a new one each time yeah that's a
really good point because I can't
remember now even how many animal
species we'd already logged a few
minutes ago so we definitely need to to
to add that in because we don't want to
get our numbers muddled up so um let's
use the icons again to make it clear
which total is coming up on the LED
display but let's also um use a new
input so we've used button a and we've
used button B to do our actual logging
but now let's use the touch logo on the
front of the microbit as the input to
show us our totals so you'll find that
in the inputs menu and if you scroll
right down past where it says microbit
V2 right down here we get the on Logo
pressed block so if I pull that out now
I'm going to use this as my input now I
said we wanted to use the icons again so
that's the next time we're going next
thing we're going to do we're going to
go to basic we're going to drag out our
show icon pop it in here and I'm going
to change this one to the animal icon
we' selected
earlier and then I want to show my total
to Al number of animal species counted
so if I go back into basic take show
number pop it in and then I find my
variable my animal species variable in
the variables menu pull that out and
that goes on top so that means when you
press the logo the duck icon will will
come up and then the total number of
animal species now I also want to to see
the plant species but I don't want it
all to happen too quickly it needs to be
clear when we read it off the screen and
then when there's numbers that are
two-digit or even three-digit numbers
they will scroll so we need a little bit
of time for the microbit to do its thing
so we're going to leave a small pause so
if I go back into basic and scroll down
find the pause block I'm going to pop
that in and let's pause for two
seconds that shows up as 2,000
milliseconds on the Block and then I'm
going to go back into basic and another
time and I'm going to get the clear
screen block here so that clean the
screen goes completely clear before it
me any of the
plant species data so now I want to show
the plant species data actually I'll
just do one more pause before that so
I'm going to duplicate that block be
doubly sure that the screen clears and
has time to clear now back into basic
take your show icon change that to our
tree like icon here go back into basic
take another show number and this time
in the variables menu I choose plant
species and put it in there so hopefully
that will have given the microbit the
instructions needed for us to see the
totals on the screen when we want to to
recap how many we've counted of each so
shall we try out on the simulator now
Giles I think that sounds like a really
good idea right I'm going to put you to
the test I'm going to show you some
pictures and see if you can count along
and correctly count the species I'm
going to reset my microb bit first just
clear any of the data we've done so far
so you would do that on the real
microbit with the reset button on the
back but I've just pressed this uh
symbol here on the simulator okay test
me fantastic are you ready yes okay here
we go that's a tree so that's a plant
species so that's one plant species so
far oh that's another tree so hang on I
need to have pressed B once but not
again because they're the same species
well done okay let's try one more right
that's a different plant species so I'm
going to press B again that's the second
plant species I've
seen there's our lovely Robin that's a
animal species a bird
okay and I'll give you one more okay
fantastic that's
another animal species so let's see if I
go to my touch logo and I click this now
let's see what
happens animals
to should clear the screen there a
little pause there two fantastic
fantastic well done woohoo so that's it
if you have got this far with us you
have now coded your biodiversity code
along uh biodiversity counter I should
say that you can use outside in your
[Applause]
playground two lots of Applause and
cheering that's marvelous so once you
know the number of the current number of
animal and plant species you could
monitor whether this changes over time
because you could count them again in
the future um you might want to try some
things in your local environment to
improve biodiversity and see if you get
better better numbers next time if you
get a more diverse environment with
different more different kinds of
plants and there's lots of other things
you can do with that data that you go
outside and collect you could present it
in bar charts or other kinds of graphs
tally charts you could share your
findings with other classes in your
school or you could compare your
playground to other outdoor environments
such as Parks or maybe even another
school fabulous so thank you for those
ideas Giles they're really useful we we
have finished coding but there is one
more really important thing to do you
need to transfer the code to your real
life microbit so you can use it to count
biodiversity in your playground outside
or another outside area so what we're
going to do is we're going to um use the
USB cable to plug our mic bits into the
computer or laptop that you've been
using now if you've been using tablets
then obviously there's a different way
to transfer the code um I won't demo
that today but the link that is now
showing on screen will give you all the
different options for how to get code
onto your microbit tablets included so
you can have a look at that instead but
I'll just do a very quick demo of how to
get it on if you're using a laptop or a
tablet or a um sorry a desktop computer
so the small part of the USB cable goes
into the top of the microbit so you can
see there and then I'm going to plug
this
into my um my laptop that I'm using so
I'm plugging it in here the USB end of
it goes in okay now I'm just going to
share my screen before I
plug the rest of it in so one second
stop there I'm going to go
to
this okay now if I do this this way and
I get up my
downloads you will see something appear
in this menu on the left when I plug in
my
microbit so I've plugged it
in keep an eye here Tada the microbit
drive has appeared there because my mic
bit has been plugged in so I know that
it's connected and so now that I've
plugged it in on my make code editor I
need to click on the download button and
follow the instructions on screen
so I click that now download and it's
downloading to my micro bit now if it's
the first time you've downloaded it may
ask you to pair it first but you simply
follow the instructions on screen and it
will then give you the option to
download it if that doesn't work for any
reason there's also a drag and drop
method where if you download the hex
file using the three dots next to the
download button you can click on
download as
file okay that has now gone to my
downloads you can see it here there's
our project that we just made and I can
now drag and drop that on top of my
microbit drive and my microbit will
start flashing on the back so I know
that that's working as well so that's
another way to get it on okay so once
you've got it on there of course the
next thing to do is to plug your battery
pack in unplug it from your uh computer
and then you can take it outside and get
going with love the diversity all around
you in your
environment that's absolutely fantastic
so huge thanks to all of you for joining
our codal along today remember do get in
touch with us by tagging us you can do
that on Twitter or X using microbit edu
be great if you could show how you got
on making your biodiversity counter
today and how you use
them yes thank you to everyone who's
joined in we hope you've had fun coding
your biodiversity counter and uh good
luck investigating biodiversity in your
local
environment bye bye for now
[Music]
n
[Music]