Showing posts with label mbot. Show all posts
Showing posts with label mbot. Show all posts

Thursday, June 24, 2021

Using flowcharts to prep for coding - Part 2

 Last week, my intermediate class were looking at using flowcharts to plan coding. They planned the small sections of how the mBot has to behave to follow the black line. Blog post here

Today, we put together all the parts from the previous couple of weeks. The binary was used to code the mBots and the flowchart and code was all put together to get the final outcome.

The students then had a great time racing the mBots round the course, changing the speed variables and adding lights at every direction change.

Link to Google Drawing here









Thursday, June 17, 2021

Using flowcharts to prep for coding

 My intermediate class are coding mBot robots. To get them into it, we have been just kind of launching ourselves in and doing "stuff".

To prepare for the "Follow the line" task (link to task on the class site here) we have been preparing so they know why the code is like it is and why the mBot is behaving as it is. Last week we looked at binary. We did an introduction to what binary is and some whole class activities and then we played some games so they got the hang of it themselves. (link to work here) 

This week we looked at flowcharts and how they help you to plan a sequence of events that have to happen. Link to work on class site here. We went through the symbols and where to find them on Google Drawings then went through the "Do you take sugar" example. The class then had a go with the "Socks" activity themselves and we looked at using loops with the alarm clock example. 

We then started to apply it to the following the black line main activity that they have to do. We went through the sequence that had to happen verbally first so they understood which way the mBot had to go in the four different circumstances. 

  • both sensors on the black line, 
  • the left sensor on the black the the right sensor on the white, t
  • the right sensor on the black the the left sensor on the white, 
  • both sensors on the white. 

We did the first two events together, then they had to do they second two themselves. It came together quite well as we were combining the binary work we had done, the flow charts and seeing where it all linked to the coding blocks. Seeing where the flowchart links directly to the coding blocks is good.

Here is my worked example, which I did on a google drawing. Maybe I should have done it on a presentation so each event could have its own page and be clearer to understand. Link to drawing here.

Next week, I want them to combine it all together and upload it to the nMot to see if it works. They will then understand why the numbers on the inputs have to be 0,1,2 or 3 and understand the flow of the algorithm.

Friday, June 26, 2020

Coding Matariki Stars with mBots

This week we have been celebrating Matariki and we have had lots of activities and competitions. Many of these activities involved the theme of stars so  decided to continue this theme with my Year 8 class this morning. We have been coding our mBots to move, make noises, make lights come on, react to sensors. Today, we were coding our mBots to move in a star pattern.
First of all, we drew stars on paper without taking our pencils off the page.
Then we looked at what we would need in mBlock to code the star. They already know the repeat block.
These were the blocks they needed to use. The tricky part was setting the variables to the correct values so the mBot will turn the correct amount on the points of the stars.



The students showed fabulous resilience today and went about the task of trial and error really happily.
We went out into the carpark about half way through. We drew big stars on the ground and walked the path so they could feel the actions that the mBot needed to take.
When they were testing the movement of the mBots in the class, we decided to tape a board marker pen to the front so it could draw on the table top. The students could then see the motion clearer and see what changes needed to be made.


. 

The students have been writing this up on their blogs and explain it much better than me.

Florence
Giovani
Karlos
Sakshi
Ellenora
Akuhata


Friday, March 20, 2020

Binary with Year 7

My Year 7 coding class are learning to make their mBots become autonomous cars. Part of that is to use the infra red sensor underneath the mBot to sense and follow a black line. To do this, the students need to understand a little about binary.

We started today talking about how they counted.
They all started counting for me out loud.
Then I asked them to add two single digit numbers together in their heads. Easy peasy. Answers were shouted out. Then I asked them to add 9 and 23. This took a bit longer in the head, and fingers were twiddled and counted.

Then I asked them to addf 329 and 73 in their heads. Some got there.
This was then written as sum on the board and they were all comfortable again.
I asked them how we know where to put the 73 under the 329 as they are different widths / numbers of digits. They then told me about units, tens and hundreds. Their teacher at intermediate will be proud of them.



After they had mentioned the units, tens and hundreds, we talked about how we count.
The name was DECIMAL as it is based on 10's. Every step to the left is 10 times bigger. We put numbers in them place slots tos ay how many of them there are of each.




I then introduced a new counting method. BINARY.
I used the class light switch as an example. How many switch places are there? 2. The switch can be on or off. The lights can be on or off. There are no threes or fours or others numbers. It is yeas or no.

BINARY counts in multiples of 2. I put the columns up to show them the difference. Each step to the left is multiplied by two this time. We did a few numbers together till they got it. 



Binary Games

The first game we played was in the car park outside. The students put themselves into teams of four for the four columns we had been using in our binary examples. They each had two pieces of paper. One with a 1 on it and one with a 0 on it.
I wrote down numbers on a card and held it up. The teams had to shuffle themselves with their paper to be sowing the correct value in binary.






Here is a slightly chaotic video ...




When we went back into the classroom, I had some binary games ready on my class site for them to have a go at.
Link to class site where the binary games are.

I thought that they might not appreciate this lesson as we did not use the mBots today, so they go no direct coding done. They did play some of the coding games that I have on my site too, but did not code the mBots.
Next week I plan to "test" their binary knowledge to see if what we did today was ok. This "test" will be in the form of an online quiz / game so they don't feel tested.
I hope this was enough for them to understand why we have to use a bit of binary when we code our rmBots to react to the black line.

Friday, February 14, 2020

Coding with Year 7 - Lesson 1

I have been preparing for my coding lessons with my new Year 7 class this year. I wrote a blog post here about how i was going to be looking at Algorithms.

Our first lesson was today, and after  we all got on my new website, found the work and I had given them a brief description of what an algorithm is, we all went into the carpark to try some out.


  • They got into small groups and decided who was the programmer and who were the robots.
  • Instruction 1 - The programmer had to give their robots one instruction and watch them do it then give them another and so on.
  • Instruction 2 - The same as one but they had to give two instructions.
  • Instruction 3 - They have to give 3 instructions bit include more details like direction and how long or how many.
  • Instruction 4 - They have to give 5 instructions, include details, one has to be sound, one movement in a line, one a dance movement
  • The programmer had to give the "algorithms" and the robots had to listen and remember a sequence of instructions.
We then got on with the rest of the prepared lesson as it is on the class site. We didn't get as far as I had planned as we spent a little more time playing in the carpark than I intended.

Things to note for next time :-
Check the mBots are charged - we had a couple of flat ones today
Check the boxes all have 6 in them - there was one with 3 today
The link to a copy of the presentation worked well and saved time.
They all got online fast and found the site and work very efficiently.



Wednesday, February 12, 2020

Preparing for my first Year 7 Coding Lesson

I have my first coding lesson with a year 7 class on Friday.
I have had some experience of teaching coding last year to a Year 8 class last year where we were making an mBot robot follow a black line using sensors.
Blog post 1     Blog post 2
With this, I was using the planning of Mr Dunn as he had been doing this with other Year 7 and 8 classes.
This is my first year planning for it myself.

To start with, I am going to talk to my Year 7 group about what an ALGORITHM is. We will relate it to real life things that they know about and my example will be knitting.

Input - the wool, the algorithm - the knitting pattern, output - a jumper.

This table is what we will fill in with everyday examples. Link to Google Drawing here.


Then we will move on to having a bit of a play with the mBots and a first go at using the mBlock software.
This is the link to my site where I have put all of the activities for this.
The activities are listed on the drop down under Y7 and Y8, coding.




This is the presentation with the first coding activity for the mBot. We are making coloured lights.
I have set it up so it is very visual (I am a graphics / design teacher!!) and so they have to put evidence of their work and thinking as we go.
This one is very simple in order to get them used to using the mBot, the online programme and having to evidence their work with screenshots, videos and analysis of what was happening.
This needs to get more complex as they get experience so they can start deeper analysis of what they did, what happened, what went wrong and what they did to change things.

Thursday, December 5, 2019

Coding the Tamaki College mBot Christmas choir - Part 2

Last week the students had a go at team coding a choir. Blog post here.
To make sure we are all on the same code today, I had a go my self at getting two mBots to sing in harmony.

Whaea Trina, one of the Tamaki College music teachers worked out the harmony for me from the original melody.


This week, I sent the code to the students in this format. Link to file here.



They then had to work as a team to work out who was going to be main melody and who was going to be harmony. 



So after adding some suitable coloured lighting effects and then putting the code on extra mBots so they could place them in a Christmas Tree pattern, here is the finished choir.


Thursday, November 28, 2019

Coding the Tamaki College mBot Christmas choir - Part 1

Today with my intermediate class who are doing coding, I wanted to do a quick "warm up" do now. This plan failed immediately and it turned into a whole double session on this activity.
We were coding our mBots to sing Jingle bells. I had found an easy version online with no flats or sharps so it could be a "quick activity". Well ... no...

We ended up trying to all code the same  so that we could all push the buttons on the mBots together and have an mBot choir. This then morphed into planning on going into the class next door to carol sing with the mBot choir.

Through no fault of their own, we had technical issues ( hey ho, when don't you when working with tech ), we did not get finished and they were not sounding as alike as was needed for this "concert".
We saved our work with the plan to carol sing at the start of next week.

When they had gone, I had an idea. I have given the music to one of our music teachers and asked them to write a harmony part and plan to get half the class on the original code and half on the harmony part.

I have written the code for the basic part and plan to give it to the students for the start of next week along with the harmony part. We can then get the whole class in the choir working together.

Part two of this blog post will be next week when we give this a try. This could be great or hideous. Either way will be fun.






Thursday, November 21, 2019

Autonomous Car - mBlock Coding Explanation

I have been coding my mbot to follow a black line and to stop if something is put in front of it.
Here is all of my code.




Here is a video of my code working (please excuse it's sideways viewpoint)




Here is an explanation  of how my code works.




At the top of my code there is the start up block that lets my mbot know there is a line of code coming.
I then have a wait control block that is connected to a sensor block that is the button on the mbot.
I have added this so that the mbot will not start the coded actions as soon as it is turned on. I can wait till im ready and press the button for it to start.





The next thing is an operator block and a sensor block. This is saying to check if there is anything less than 10cm away from the front ultrasonic sensor.


I then used an "if, then, else" control block.
I used this because it gives the chance to put two different options of actions for the mbot to do depending on a condition.










The ultra sonic block is placed in the if.
This is saying that if something is less than 10 cm away from the ultrasonic sensor, the mbot does the actions in the "then" section.

These actions are:-

  • The mbot will stop, so it doesn't run the thing in front of it over
  • It will show red light to show it is stopping
  • It will make a noise as a warning


















The movement around the black line is put into the "else" section of the main control block. This is because it is the other thing the mbot has to do if there is nothing in front of it.

These sections are all put into "if, then" control blocks. This is because there needs to be a condition happening for the action to happen. If that condition is not happening then it will move onto the next code block.



There will be 4 of these and they will be based around this binary information.

Left Right21
Black Black000
Black White011
White Black102
White White113

This works like this ...


The code for this section, with all 4 sections, looks like this, where all of these 4 possibilities are in their own "if, then" control blocks.



While it is following the line, a green light is showing so this is the first thing inside the else section.



All of these "if, then, else" and "if, then" blocks are wrapped by one forever around the outside. This is because I want the mbot to continue to check for these conditions all the time. If the forever was not there it would do it all once then stop.