Lego Coding in Grade Three Final

For the final lesson the students edited their hand written coding draft looking for “loops”. When they found loopable text they rewrote it as a loop. Then they typed up their final draft. Here is an example of that final draft on a Google Doc.

One great thing that came out of this lesson was one of the teachers saying to me. “Wow, I could do this during my instructional writing unit next year.”


See if you can follow her code?

Lego Coding in Grade Three part 1

The grade three teachers this year asked me to do some coding lessons as we had wrapped up most of our curriculum needs with all of the doubling up that I do at the beginning of the year. I thought to myself “Sure, and this would be a great time to develop the Lego Coding lesson out more fully.” So here it is. 

First, I started the students off by explaining that we were going to do a combined math, language and IT lesson. They all kind of looked at me like I was a bit crazy (but we all know this is true so they have learned to just roll with it!). I reminded them of the coding with legos lesson that they did in second grade. Then I told them that we were going to do a more complicated version of it. We weren’t going to use symbols or make up our own language, but we were going to use “real” coding terms. 

I gave them each a base plate and six legos. They then had to decide on their starting positions. As you can see in this picture. Each group decided on their own arrangement for their starting position. The only rules were that no lego could be on top of another and they had to all be on the bottom half of the plate. 

Then they began some of the math elements by copying their starting position into their math books. Their book have 1cm squares in them and I told them that 1 square = 1 dot on the base plate. They had to make sure that their drawing matched exactly the position of their starting position. This took the rest of the first lesson to get correct. There were lots of students at this point making connections to doing coordinate point work in previous math lessons. 


The next lesson that we had I introduced the coding language terms that we would be using and asked them to record them in their books. I choose some simple terms to get them started. We had a discussion about which direction forward and backward were on the base plates and when lift and set would be used. Also how “turn” would have to be combined with “rt” or “lt” and have a number added. I had an image on the board showing what 0 – 45 – 90 degree turns of a rectangle looked like. 
Then we started with the first line of our code. I explained to them that they needed to put a # then a sentence telling their “computer” what materials they would need to get started. We quickly realized that 4 dot Legos could come as squares or rectangles. So, we discussed how they could be described so that the “computer” collected the correct Legos at the beginning. They learned that lines that begin with # are things to read not do. They help the “computer” understand the instructions that are coming in some way. 


Then they set about coding. They were only able to code a few lines before the time was up and what was really nice was the “ahhhhhs” that I got because they had to stop. They wanted to continue! It was great. 

The this week they got on with more coding. And again they didn’t want to stop. They wanted to finish their first draft, which most of them did. 

My plan is to have them “edit” their work like a piece of writing. The first edit will be for “Does it work?” which they will do with each other. As some of them have already found out, they aren’t’ always correct in their first draft. 
Then I have taught the ones that have finished how to make repeat loops in their code. Then they went through their code to find places where they could use repeat loops and they rewrote those sections. 
After the on paper edit, I am going to have them type up a Google Doc that has their code in a published format. I will have pictures of that part on my next post. 

Coding with Legos in G2

This year once again I am doing a “Coding with Legos” lesson in grade two. I first discovered this lesson through a Twitter post that led me to and idea put out by “An Excited Educator“. I have used this idea in both my Geek Squad and in grade two.

The grade two students study a unit with the central idea of “People use symbols to be expressive and to communicate”. My coding with Legos lesson works well with this unit because part of the lesson is to develop a “programming language”. I talk to the students about how we are going to develop our own language using symbols to help a robot move Legos on a base plate. I show them what I mean by moving them. Then I ask them to think about what directions/moves they might need.

We generally end up with the usuals of forward, backward, move right, move left, turn right, turn left. We also decided that we needed pick up and put down for when to take the Lego off of the board and when to push it back into the board.

Once we have decided on our language we copy it down from the board so that it is in their math books for them to easily reference. They use math books with 1cm squares so I ask them to make sure that the symbol is in one square but not too close to the edges.

Then they begin to decide on a starting position. As a pair they

work together to decide where their Legos will begin. One of the lessons that I have learned by doing this is to give about 6 Legos that are different sizes and colours. This helps with the directions and knowing which piece to move.

After they find their starting position they need to draw that starting position on their paper. They have to decide how they will represent their Lego pieces when doing this. Some choose 4 Lego dots = 1 square, some decide 1dot = 1 square. This is a good time to see how the student’s spacial awareness is. I find that some students are very comfortable with making a copy of their starting position and some need a lot of guidance encouraging them to count rows and dots, in order to find the right spots on their paper. If I have a group that is really struggling and I am running out of time I take a picture and they finish at the beginning of the next lesson. This is usually the end of lesson one.

Lesson 2 begins with the students recreating their starting positions. Once they have found these starting positions I give them a bit of time to think about how they want their Legos to end up. I tell them that they must have some that are stacked, but that is all that I say. They play around with finding a pattern that they like.

Then we come together and I say to them. “Now you have to program your robot. You need to tell you robot which colour Lego it should start with. Then draw that on your page and under it with one direction in each square write a program for your robot, using only the symbols.” The very cool thing about this part and most of the steps until here is that even the EAL learners are able to participate fully. Because this is not an activity that is English based they have no problems writing their code with their partner. For them it must be a relief to be able to do a lesson where English is not a huge focus. Once they understand what they are doing they need very little help.



At points along the way, I will interrupt them and be the “robot”. I try out their code and see if I get to the places that they want me to get. The biggest issue so far is the interpretation of a turn right or turn left command. That can make all of the difference. Since these are just second graders I tell them that they must show their robot before it starts what their turns look like, so the robot can try to copy it. If I was doing this with older kids I would have them figure out a way to embed it into the coding of the program. I generally need at least three full lessons to complete this activity, but one of the nice things is that it works so well in the classroom, I can leave it with the teachers and they finish it. This frees up our IT time to work on something else.

For me for IT the goals of this lesson are an introduction to coding/programming, using problem solving techniques to fix programming errors and making an authentic connection from the curriculum to my subject. For a classroom teacher the goals of this lesson could include using problem solving techniques, instructional writing techniques, working in partners, proofreading their work to clarify it, and organizing their steps in a sequence. I am sure depending on your scope and sequence documents this list could change and grow.