DreamSpace TV - Episode 6
Hi everyone and welcome to dream space tv, here in one microsoft, place in dublin, my name is amanda, and i'm corey. In today's, episode, we are going to learn about coding. What coding, is why it's important, and we're going to start coding, a micro bit so excited. So excited. But before we get started on that let's recap, on our last episode. Because in our last episode. We created a tower that was at least 40 centimeters. Tall, and was able to withstand, a shake. Amanda's, tower's so tall at 50, centimeters. And she called hers, the milkshake, tower. Which doesn't surprise, me because she loves milkshakes, she doesn't stop talking, about them. But there was one small problem, and that's fine because we can just fix it amanda's, tower, fell over when she shook it, well it's kind of a big problem. And, so yeah, as we saw in our last episode, my tower did not withstand, the shake, so i had to go back and have a look at it and see what went wrong, but i think it's okay now corey will we test it again to prove to everybody right let's see what i'll count you in okay are you ready yep three. Two, one. Right i'm delighted, for you thanks. My tower stood strong at 42. Centimeters. Tall. And i called mine the pool bag towers, as an ode to the pullback chimneys that i see out my window. Every, single, morning. So, now we're ready to start coding, and remember. Over the last five episodes, we've been preparing, you for this moment, because we've been getting you to think computationally. Computational. Thinking is the scientific. Logical way of thinking, that we use when we code. So i think they're ready. But. What exactly, is coding, myself and amanda have thrown around the term coding this encoding, that, but all coding, is it's just a language, that us humans, use, to talk to computers. Okay, so it's no different to any languages, that you learn in school maybe like irish, or french or spanish. It's just simply a language that us humans, use to be able to tell the computer. To solve a problem, or perform a task. But why is coding, so important. Well coding is so important because it's behind, every, single technology, we use, so imagine, corey, if we didn't have people who could code. None of this technology, we use every day would be working. Now now would be a good time to pause, and think about, different technologies, that you might use every day that use code. So things you might have thought of there would have been websites. Or apps. Computer, games, maybe even a computer, and all of those things are right aren't they corey yep. And a lot of people use these technologies, in their everyday lives maybe in their work lives for example. And work is really changing, how people do work is really changing, even in areas, such as, agriculture. Or finance, or medicine. Areas where maybe they didn't use a lot of technology. Now they do because it actually helps them do their jobs. Technology, remember can also help people in their everyday. Lives. So we looked at a few episodes, how ai, and technology, could be used to help the planet. Exactly and specifically. To help take care of endangered. Animals, which we really enjoyed actually didn't we yeah. We also have a really, favorite, app that we look at here in dream space called seeing, a i, and this app helps people who are visually, impaired. So it's a really cool way again, to show how coding, and apps can help people, so we might show the movie yeah, okay, so i'm gonna, get this going here now. So i'm going to open up my app cnai. Zero faces. And as you can hear it's already talking to me, telling me what it's looking for around, now actually down the bottom of my app there's lots of categories. So i can actually decide, what i'm actually trying to understand so remember this is for people, who are visually impaired, who can't see very well, so the audio, is going to tell them what's around them, i'm going to select, person. If it's okay with you corey you use an example to show how it can scan, and identify, if there's a person in the room is that okay sounds good perfect. So i'm going to hold, up my camera. One face near top, one face near center, three meters away. Perfect. So, one face near, center, so in the center of my camera. And they are three, meters, away, so that's very clear for someone who maybe can't see very well to know that there is a person. And they're roughly, three meters away from them that's pretty cool isn't it yep, now it can do a little bit more do you want to look at that cory yeah, okay, so, if it's okay with you i can actually select for it to actually just take a photo.
And Look in that photo, for a person because remember that's the category that we're on, are we happy to do that let's do it okay. So i'm going to hold this up now, i'm going to select. 28, year old woman with brown hair looking happy. Wow, okay, so it's saying a 28 year old woman with brown hair, looking, happy. I'm glad you're happy. I'm very happy. So it's not only identifying, an age there, it's really interesting. It's also identifying, hair color, and how happy the person is, isn't that amazing, i love it and all of that is done, through, code. So when we think about coding, remember, a couple of episodes, ago, we talked about, algorithms. And how they can be step-by-step. Instructions. Or a formula. To figure stuff, out. Now will be a good time to pause. And write out what you think the algorithm, is that this app is using, to identify, what it just. Did. The algorithm, that the app was using there was based on the input it was getting from, the camera. So when you think about it i held up the camera. The information, around, went into the camera lens, and then the algorithm. Figured all that out. Then we heard an output, which was, audio. So that's really really cool isn't it so cool. Now that was using, a i so it was a little bit more advanced maybe than some of the algorithms, we'll work on in the next few episodes, but it just shows you that when we begin to code and look at these things, that's how advanced we can get and we can really really help people. Now. Today. We are going to start coding, with the micro bit, now the micro bit doesn't have ai, artificial. Intelligence, built, into it so it can't make decisions, for itself. But it can still do some really really cool things the only difference, is, we have to be really really specific. With the code that we give it or with the instructions, that we give it, so let's take a closer, look at the micro bit and the different features that it has to it, so. As you can see on my screen here here is the virtual, micro bit in all its glory, looks great i love it, so, it has, 25. Led, lights which we can do such cool things, and amanda is actually going to showcase, this later on. It also, has, inputs. An input, is when the microbit, is able to take information, from its environment. So for example, it has these, gold, pins on the bottom. And with these pins, we can actually connect it to other gadgets. It also if you look closely, it has, two, what is known as buttons, on either side, so it has an a button, and has a b button, and as the user, we can actually use these can't we matter. It also has so many other cool inputs. Such as a temperature gauge so we can tell the temperature. It has a motion sensor so it can like, know if you're moving around or not, and, apart, from inputs, i think the coolest thing that this has, is a bluetooth. Antenna, so you can actually talk to other devices. So, i think they're ready to start coding amanda what you think yep, let's get this show on the roads. Okay. Now, before, i take over from here where corey is i want to show you how we actually get here, so i'm going to go to a new tab. In my internet, browser. And i'm going to come up to my web address. And i'm going to type in, make code. Dot micro bit. Dot, org. Okay we got that right, makecode.microbit.org. Go. Right and when we do that we arrive, onto this page and you can see there's the project that corey was actually already, in so it's automatically, saved that, and on this page there's lots of other cool things that you can look at again, but we want to go from a new template. So we're going to go, new project so i'm going to click on this one. And then i have to name my project so that i know how it saves, and i'm going to call it d. S. T. V. And after i've named it i can click, create. Perfect. So now we're into the blank page that we need to be in, there's the name of my project, i can click save if i want to, and i think i'm good to go so let's look at our coding options when we look at the screen that we have in front of us here as corey said, here is our micro bit, so if you're looking at this screen you'll see, okay we have images but actually these are simulators. And what we mean by that is it will actually allow us to test our code so you don't, actually, need, the real micro to be able to carry on with what we're going to do here now. We also have all of these categories. Don't we worry, yep, and they're color coded, which is going to be really handy because, we'll know then that if i see, a green block over here, i must have gotten it from the green, category, for example.
Okay, So if i go into the blue category. I have all of these, blue blocks. All right, so and i can simply select to bring them in so will i just grab one, yeah. Grab the one that's jumping out at me is the, show icon. Okay, so i'm gonna just move down here now i'm able to touch my screen this is a pretty cool screen, it's okay, you might have a touch screen you might have to use your mouse, whatever way it works but just grab on a block, and drag it in, now i'm just going to put it here for a second because this seems to be the area, that i'm going to be doing my coding in corey yep yeah, so i'm going to leave it there and i'm, hoping. That when i brought that in, i would see my icon of a loveheart but there's no sign of it any ideas corey, well. How i'm looking at it is it actually looks like jigsaw, pieces. So do you have to, put that inside. Another block. For it to be active, yeah, so as you can see. These blocks, have little, shapes to them i suppose and as they're like jigsaw pieces they're going to click into place, so i might decide, that my instruction, is going to say, onstart. Which i'm assuming, means when the micro bit starts. Then, do something, because remember what coding is it's just. Step by step sets of instructions isn't it corey yep, so we're going to grab show icon. And let it go in and see the way it's highlighted in yellow there, that means it's going to click into place so i'm going to let that go. And now let's see does my simulator, show me, aha. Happy days that's so cool. So what's really cool is you might see that there's an arrow beside, the icon there the loveheart. And that means that we have, options. So you'll see this across lots of blocks but let's check it out so i'm going to click on the arrow. And you can see i have lots of different options in here, corey maybe you can pick one out for me anyone jumping out at you there um what about the happy face, aha, i see it this one here yeah so i'm going to click on that and before i click on it i want you just to think about this, when i click this, my instruction, is going to be show icon. Smiley, face so, there we go, so that's how simple it is we're given instructions, for this micro bit to follow, and it's doing exactly, what we're saying because we're being really, really clear. Sometimes. We can go further than that we don't just have to do one thing here, we could say, show an icon of a smiley face. Then show me the icon of a love heart, and maybe then show me another one yeah about that, so i'm going to go back into basic. And i'm going to go and grab another, block. And i'm going to let that go in yep. So we'll leave maybe, that's our second, instruction, there our second, display.
And Then we'll go, for our third one. And maybe this time corey i'll pick yeah, and i'll go, with, uh duck. Love it so now we should have three things flash up if our code's right, two three. Happy days so that's our sequence of instructions, that's my sequence. Exactly. So what we're trying to show you here is it's really up to you you. Are in charge of the code and you're in charge of the instructions. And the order, as well you might decide i want the duck to be first, so then you grab the block, bring it up to the top like that it'll highlight, for you, you let it pop in, and voila, the duck is first. Happy days. Now corey talked about some other things that the microbit does as well, so, one of the words you said actually corey was input, yep, so remember an input, was how the microbit, took information, from its environment. So one of those things might be that we as the person using the microbit, might decide that we want to hit this button a, and right now when i hit a. Nothing is happening, and it should happen if the code is right, but actually speaking of it. I don't see any code in here corey do you no, okay, so i'm going to go into input. And i'm going to drag out, this instruction. On button, a pressed i think this is exactly what we're looking for. I'm going to drag this one in. And i'm going to leave that there. So let's think about this what do we want the microphone to do when we press a cory any ideas, um well let's pop back into basic. Have a look yeah have a look yeah. Okay what's in. Here. What, about. Show, string, what's that. Okay. Show, string. Oh wait this is one of the favorites, i think that we have in dreamspace, because if we bring out show string. And remember. We need to tell the microbit, when to show the string it needs to be very clear, so we'll tell it to do it when we press, a. Okay, now at the moment the string. Says hello. So a string. Is basically. A lot of times letters but you could have numbers or you could have, symbols, like we have an exclamation, mark here, so i'm going to go ahead, and in here i'm going to delete the word hello. And instead. I'm going to type. Oh, i'm spinning the row i'm going to type dream space, because that's where we are. Okay. Now what's so important, is as we code. We keep testing, our code yeah, because. Like when we were doing our other challenges. There can be mistakes. And we call them, bugs. And we need to find them as quick as possible because otherwise it can be pretty hard to find out where the mistake was so i'm going to just test did this work, so i need to press button a but i don't have my micro bit so what do i do cory, well you could use your virtual micro bit, because remember i said the virtual micro bit actually has two buttons as well yeah so why don't you press button a, on your simulator. Right let's do it i'm going to come up here i'm going to click on a. Yes. So cool, okay, and my string. Is scrolling. Across. My screen. So, that's the basics, of how it works there's one other thing i'm going to show you. Which is how we delete a block because sometimes you might say actually. On a i don't want a string at all i want another icon, or i'm going to take my love heart down and move things around. So i don't want this anymore, so i can either pick it up and drag it over to my category, here. Or i can just, uh, click on it and click delete if you're using a laptop so it just depends but i always do this even if i'm using a laptop yeah same i drag it over, a bin appears. And i let it go, and it's gone, and now i might say actually on a, i want my love heart instead so i bring that block in, instead. And i can just check that works because i'm that's my habit i'm in, keeping. Yeah okay it's working. So now will be a good time to pause, and just get familiar, with how, make code and for the microbit, works, so move around the blocks. Try something new you don't have to copy exactly what i did because remember, you're in charge of the coat. So, hopefully now you're familiar, with, how the app works and how we can move things around.
But When we code we normally have a specific, thing in mind or a specific, reason to code it's not just playing around we want to do something yeah, in our last episode, we created our towers. And we told you that we were going to link our coding to our towers which we're going to do yep, but before we do that we're going to plan out the code because again, people who code, they don't just start coding, they really think about it before they start so let's go and do that cory we make a plan okay let's do it, okay. Now across the last few episodes these are the steps we've been following. We haven't been necessarily. Coding. But we have, been making things and computationally. Thinking and we've been going, planning. We do it and we review, and that's really important we're going to keep that kind of sequence of steps as we go, so we're going to start with our plan now right, so corey, last day with the tower we talked, about. Um, naming your tower. Getting your tower height wasn't it so i'm going to just write these two things down so. Get the name. Okay, thank you so terror, name. The tower, height. And, um. What if we get, they might want to display an animation. So like oh cool a little animation, okay so that's when we're going to add so we're going to add display, and animation, so we'll talk about that in a minute about how we can get the microwave, to do that. And then finally. Probably most important one was we wanted to actually sound an alert. If our tower was to shake, okay because we were talking about earthquakes. So that's a really good idea could our micro bit alert, us. If the tower moves. Okay very good so i'll say, alert system yeah okay. Alert, system. Right, so with our plan we know this is what we want our micro bit to achieve. So now let's figure out how we're going to do this now we're going to take a specific, approach here but you could take a different approach and that's what's again really important remember with the code it's up to you but what we do want you to do is try and include all of these aspects. How you do that, is how you can put your own spin on it so let's go in and start with tower, name, cory so when. Do we want the name to appear of our tower, well i would do it on start. Okay but that doesn't mean that you have to do yours on start, you might do yours on an input, but for me i'm going to say, onstart. I want to show my tower's name okay we'll go with your plan for the moment so we're going to say, when the microbit, starts. So on. Start. And then we want to see the tower, name so what are we going to use there, based on what we've seen already maybe we're going to use a string. Okay. So we're going to say on start, we want to show. The string. And then instead, of hello, which is the one that's automatically, there we can change it and i can say milkshake, tower yeah okay perfect. Terror, height now you made a good point there, about how we could use inputs, yeah, i've already, shown, everyone on button a, but there's another, button, there's a button b, so i think for my tara height i'm going to use button b and i might use a later on. So i'm going to say. On, button, b. And then what's height going to be corey, well when i was watching you going through the basic blocks, i did, spot a block of code, that said, show, number. Okay, perfect, that's what we'll use, so because we want to change it up a little bit yeah so we'll use, show, number, and then in the number area, we'll enter. Our tower height, okay, perfect. Animation. Then so this is where i might use a if that's okay i can jump in, and do on button a. And i'm actually not sure how we're going to do the animation. So maybe when we go into, our app we'll have a look at this yeah but i at least we know our start and instruction is going to be when we press a, and then how the animation, works, we'll figure out figure that out, okay. And finally, alert, system. So remember this is meant to be related back to our earthquake. Yeah so, what do you think, um, well, can we use some sort of like, music. Or like a. Tone, or, we can or even we could use a string. We could because we could say, there's an earthquake happening. So we actually have many options here, lots of options, but what about. How's it going to react, what's the input here well it needs to be an earthquake. Yeah so, we need, somehow, for the microbite, to be able to pick up that there's a shake happening. And if you remember, one of the sensors, that i said i had was that it was able to pick up movement.
Okay So it might be able to do that so we'll need to check i'm going to write movement, here so we'll check what options we have maybe with movement, yep, okay perfect. And then when it moves, we have options there like you said we could use a string we could use some. Sounds, potentially. Yeah so we'll say we'll do both i'll write both in remember, we can, we can come back to our plan and check afterwards. Okay, now that looks like a lot and you may think well we could have just gone and done that but actually i feel a lot better now that i've made my plan same. So now will be a good time to pause and make your plan for how your microbit is going to work with your, tower. Right so plan is here i'm going to go back to my screen. And let's have a look at my micro bush. Now remember the code we looked at earlier is actually already on the screen, and i don't want this because i have a different plan in mind, so i'm going to start deleting, things yes so like we said earlier we're going to drag and drop them. Over to the bin. Gone. Okay now corey my plan has gone so i'm hoping you remember, yes what we had on the screen i do so i know we said on start, we were going to do something yes we were going to actually display the tower's name. Okay perfect, so i'm going to go into basic. And i'm going to go. Show string. And remember. I'm going to click this into place. And in here instead of string. We're going to go tower, name, i'll actually. Use your one, sorry i'm going to move over here. Okay. Pull back chimneys, how could i forget oh actually but it was an ode to them so it was the pullback tower who beg tower, just be more specific. Okay. Pool bag tower okay now on start we should see this. There we go. Woohoo. Working, so i'm happy enough. The second thing we wanted to do was display, our tower, height. And you said that you wanted to do this on button, b i did, so let's go and find button b i'm going to hop into input. And. I cannot. See. Button b, so if you want to have a look. If you're watching, now, and be thinking to yourself, where is b and i can guarantee. That you're probably screaming now saying, there's an arrow. Right and you would be correct. So if i bring in on button, a. There is an arrow, and remember that means we have, more options. Yet so hit the arrow. And actually there's more i cory there's a and b as well so there's three ways to use the buttons i can hit a on its own, b on its own or i can hit a and b together together so i'm gonna go with b. And then we said you said you've spotted show numbers. Yeah it's the first block. Bring that one in. And corey what was the height of your pool bag tower it was there in about, 42-ish. Centimeters, okay, perfect. So, delete, zero, remember so i'm just touching on zero, getting rid of that because that's not the number we want it wasn't zero centimeters. No and we tell the microbit instead, show us the number. 42.. Okay. So, will i go straight on now no no no you need to test this as you go remember oh okay thank you, so, we are going to test this, remember. We want to see well what was what when are we asking, the microbit to show us the number, we're asking it to do it when we press b aren't we so i'm going to go ahead and press b. Oh it's still finishing its string so that's actually a good point sometimes, it has to finish its code. So, right now, it has to finish what it's saying we can't override, that one so we're going to hit b. 42. Happy days, okay. Right, so that was number two let's have a quick check of our plan. So. We have tower.
Name. Done, yep tower height done. Animation, and we said we'll do it on button a but we better check and figure out how we do this okay, so let's go back. Right, so on button a remember i go to my input. I'm going to bring this one in. I'm going to move this over here, give yourself more room. Okay, so let's think about, what an animation. Actually, is. So it tends to be a series of images, yep. And. We see movement, a lot of the time with an animation don't we yep. So let's have a look i always my go-to, category, when i'm just playing around and trying to figure things out is basic, same. Because there's always lots of nice things in here. And if i think about it. I could use icons. Maybe. But. I want my animation, to be of my tower, yeah. So. What about this one yeah because then that means if we bring out show leds. We can create our own icon. Aha, so we can make it look like our tower so this is just an, empty. Matrix. Of these led lights there's 25. Empty spaces, which are each light. Very cool, so i'm looking at the shape of my tower let me go and grab it here. Hopefully it doesn't fall apart as i move it. See i'm just proving that i did fix it. Okay. And, if i think about it so it's kind of wide on the bottom, yep and then it comes in narrowly and then it kind of goes a little bit wider at the top yeah so i might try and do that, try your look at it, but i don't want this just to be, an led, light, you want it to be an animation, i want to, move. So how about i build just the bottom first. Yes i'm going to turn these ones, on. And then i want to go layer by layer so that it looks like it's moving i love it, okay yes so i'm going to just zoom out so that we can see it all come together, a little bit. So i'm going to do one. And actually i might do, kind of bring it start bringing it in. And then i'm going to just basically, copy that but then add a bit as i go, so it goes kind of narrow for a. While. And go again. I'm looking forward to seeing this animation. Okay i hope it works. Then it's a little bit wider down there yeah, and then i think it comes back out with the cup then doesn't it.
Yeah. Ah, very good, okay. Now i'll zoom out just so we can get that in full because i know that's a lot of blocks oh. God i really have to zoom out that's quite small i know. But you can see there's, quite a long sequence, there, so on button a. This light then this light then this light then this light will you test it. Okay, so on. A. Aha, i love it okay. Now i would love if that just happened a couple of times. So instead, of instead of me, having to do all this again. I want everyone to think back to a couple of episodes, ago. When we talked about how instructions. Could happen a couple of times over, yeah. So corey, hopefully everyone's remembered what are we looking for here loops. Loops. And if you look carefully, at the category, here we have a category, called. Loops, so i'm going to hop in here. And, i'm going to see so i'm going to zoom back in because i think that's a little bit zoomed out. There we go so hop in and i'm going to get my repeat. Block. So we were doing an obstacle, course how could i forget it. And i had to. Hop over my hurdle, three times so i was told repeat, that, three times. In this case we want to repeat our animation so i'm going to grab that one. And, i'm going, to. Drop that in. Now. Let's see do you think that's going to work we will test it let's see yeah. I'm going to check does that work. This has to happen all the time i might we might move that out in a second so i'm going to press, a. And, i thought it was going to do four times but let's have a look and see how clear. Our code is here we might have to debug. Here, so when i press an a, repeat, four times do. Nothing. Yeah, and then do this. So. Looks like we need to move that inside. So it knows exactly, what to repeat. Okay. Very good and i'm going to just take out my on start instruction, for one sec corey if that's okay, yes, so that doesn't have to. Move across all the time, for a second. And, i'm gonna now test, my coat. One, yes. Two. Three. Four i love it. There's my loop very good all right, happy enough. Right let's check the plan. That's our animation, done, we figured that one out. And the final one was an alert system i'm not going to do this in full, i'm going to we're going to just maybe start everyone off on this one, and then we'll we'll, wrap up okay. So. Let's see i'm going to go back in. And i can see here, i have. We talked about how a movement. And a movement could be picked up as an input, yes, so we're going to input. And have a look here now. Corey what you think. Unshake. Yes, it's actually, perfect. Exactly. What does an earthquake do it shakes the ground, like this it couldn't be any better, so, on, shake. Now. Hopefully, people are as excited as i am when they notice there's an arrow there. And it means there's options so just out of interest let's see what other options there could have been for movements, so i'm going to hit that arrow. And you can see there's tons of things logo, up logo down screen up screen down, we can tilt it yeah, free fall which is basically if we let the micro bit go so this microphone, here if i literally, dropped it to the floor, that will pick up a free fall. And and then we have these kind of figures here which sometimes, confuse, people they see these 3g. 6g. Hg. That's just the acceleration. Of the movement, so how forceful, it is so that could technically, work as well if we were thinking about, how, aggressive, or is the shake, that happens. Yeah but we'll go with the basic, on shake for the moment okay. So i'm going to stop, there. And there would be a good time to pause and for you to think about, what you're going to do inside, that on shake, block. So now that you have your plan done, it's time for you to complete this challenge, at home, or in school. So the first thing that you need to do is log on to. Makecode.microbit.org. To complete this challenge. Now, don't forget, to. Name your tower. Display, your tower's, height. Come up with your own creative, animation. And finally. Very importantly. Make sure that you have something, on the input. On shake. So that your tower knows if an earthquake, has happened. Thanks for watching today's, episode of dream space tv we hope you've enjoyed beginning your coding journey with us and we look forward to keep going with that in the next, episode.
Bye. Bye. You.