Tag Archive | creativity

Learning Python with the micro:bit

This is such a big year for middle school computer science. I think that finally, for grades 6-8, there is a whole menu of really high quality teaching resources – from hardware tools to lessons and tutorials to standards to whole curricula. I’m pretty much changing how I do EVERYTHING, which is exhausting but exhilarating at the same time.

In the standards area, there is a new set of standards released by the Computer Science Teachers’ Association, or CSTA, located here. They are very good overall, building from grade level to grade level, organized by concept and very clear. I think it gives a nice progression for students. Many states, my own included, are involved in efforts to develop statewide standards, curricula and resources. It’s been great to see CS education move forward and the middle-years progression is really coming together.

As far as curricular resources, there are a few great new options. Code.org has a middle school course called CS Discoveries. I didn’t get to attend the training this summer, but one of my co-workers went and although she’s not a programmer by background, she came out feeling excited and confident that she could teach the curriculum and do a good job. It’s very well done so that pretty much anyone can take it and run with it.

The middle years are a great time to introduce kids to physical computing, the idea that you use algorithms and code to program devices in the world around us. It’s such an important tech literacy concept! The CS Discoveries course uses a platform called the Circuit Playground from Adafruit. For a long time, I’ve enjoyed the Sparkfun Inventor’s Kit and its little curriculum. I’ve also noticed a lot of buzz around the UK’s platform for introducing kids to physical computing – the BBC micro:bit. They are cheap and very engaging. I ordered a class pack of them, and from Sparkfun the price is really reasonable.

The BBC micro:bit Go bundle I purchased from Sparkfun.

I teach block-based programming to the sixth-graders and then work with the older middle schoolers on transitioning to text-based programming. For the younger kids, I was thrilled to find an entire CS curriculum for the micro:bit published by Microsoft. It is so good! I love its emphasis on “making” and creativity, and I enjoy the little unplugged activities. I was skeptical of them at first, but every time I try one of the unplugged activities I find the kids really enjoy it and it does help the concepts stick better. The curriculum is easy to follow, and I find the kids love finishing the lesson and then just playing with what they can do on the micro:bit.

I’m finding I can’t do some of the “invention” activities, because I only have one class set of micro:bits and they’re shared throughout the day. I can’t have kids mount the micro:bit in a pet or wearable, for example, because the next class needs them. That’s really a bummer – being a maker involves more than just code. I might try to do an invention project with the kids with the caveat that the enclosure has to let you insert and remove the micro:bit easily. We will see how things go this semester.

As you can see from the title of this post, one of the things I’m playing with is teaching text-based programming via Python to the seventh- and eighth- graders. I was not lucky enough to locate an entire curriculum for this, but there are some good resources out there. I am using the micro:bit python editor. You have to save your files locally instead of in the cloud, and actually this really beneficial. The students I have this year have had laptops in their classrooms since 2012, so they’re “digital natives”. But they’re so used to Google Docs and such that they sometimes don’t have a concept of what a file is or where it is actually stored. So we’re learning about local storage, networked storage, removable storage and cloud storage and figuring out how to access a file from different locations.

There are a lot of tutorials and a good reference at this site: micro:bit Python documentation. It gives a nice introduction to the different features of the micro:bit, but it doesn’t really teach Python. So I’m stitching together my own curriculum and put together these exercises.

In Lesson 1, we just wrote the normal Hello World program and the students were tasked with writing a program that displayed text and images, using some of what they found in the documentation. This task also involved uploading a program to the micro:bit and saving the file in local and networked storage.

# Add your Python code here. E.g.
from microbit import *

display.scroll('Hi!')

while True:
 display.show(Image.HAPPY)
 sleep(1000)
 display.show(Image.HEART)
 sleep(1000)

 

In Lesson 2, we reviewed Python syntax and common mistakes and troubleshooting. We introduced the terms “function” and “parameter” and saved some notes on these. We talked about the “while True:” loop and why the indentation is important. It’s not just picky – the indentation communicates important things to the computer! How will it know which steps to repeat without some way of blocking them off? Then we introduced variables by making a little program that displays text that changes. Students guessed at what it might do, and then we ran it and tested the hypotheses.

from microbit import *

name = 'Dawn'

while True:
 display.scroll(name)
 name = 'Tyrone'

 

Next in Lesson 3 we made a little counter program and demonstrated the difference between the string and text data types. Students could modify it by adjusting the starting value, displaying only evens, only odds, etc.

from microbit import *

# declare a variable and assign it to a value. 
counter = 0

while True:
 display.scroll(str(counter), 50)
 counter = counter + 1

By the end of this lesson, some students were feeling frustrated at how hard it was to load files, save files, upload to the micro:bit, figure out where the errors were and so on. But these are short programs and the debugging isn’t hard once you’re used to it. Students have to read the error on the micro:bit and it tells them which line the problem is on. They need to pay attention to little details and that can be exhausting, but it’s so important to give clear instructions to a machine. The machine can’t guess what you mean! We talked about how hard it was for them to write their names when they were children. If you think about it, it’s a long process! There can be dozens of little steps involved in writing your name and they were pretty bad at it when they first learned. But over time the steps became automatic and they got better, and now writing their name is a very simple task. Same with coding and debugging.

I could tell students were jonesing to make something that looked like a game. I decided to introduce random numbers as our next concept. So in Lesson 4 I had student volunteers pretend to be human variables, and we modeled what it would look like to write a program that multiplied random numbers together. First a random number is assigned to variable a. Then a random number is assigned to variable b. Then a and b report out what they are, and they are multiplied together and the result is stored in variable c. We report the result from variable c. Kids acted this part out.

Then we wrote the program together.

from microbit import *
import random

bob = random.randint(1,10)
jeffrey = random.randint(1,10)
display.scroll(str(bob))
display.scroll("*")
display.scroll(str(jeffrey))
display.scroll("=")
wilma = bob * jeffrey
display.scroll(str(wilma))

 

Many kids wanted to adapt their program to include a “forever” loop and keep producing random math problems as long as the power was switched on. By now they understood why the indentation worked, so when I suggested a “while True:” loop with everything indented after it, they were able to add it on their own.

 

Lastly, I wanted to introduce them to the coordinate plane on the pixel grid. For Lesson 5 I set out 25 pieces of paper in a 5×5 grid shape. I asked for one student to be a “pixel” and another to give directions. The student giving directions had to pick a random piece of paper, and in as few instructions as possible, tell the pixel where to go. We did this a few times and then I suggested that we make the paper in the top-left corner be (0,0). Then we realized we needed a sensible order for the row/column coordinates, so we defined “x” and “y”. We found out quickly that the pixels could only go from 0 to 4 and that 5 was off the grid. Lastly we introduced a “brightness” parameter, so when the instructor student commanded a pixel, they could tell the pixel student to go to an x coordinate, y coordinate, and to squat or stand according to a brightness level. So then we wrote this simple program and I reinforced the terms “function” and “parameter”.

from microbit import *
import random

while True:
 display.set_pixel(2, 3, 9)
 sleep(200)
 display.set_pixel(2, 3, 0)
 sleep(200)

 

And then we modified it to use variables instead of fixed numbers and the kids really liked the pixel dancing around on the grid.

from microbit import *
import random

while True:
 x = random.randint(0,4)
 y = random.randint(0,4)
 display.set_pixel(x,y,9)
 sleep(100)
 display.set_pixel(x,y,0)

Note I haven’t done much in the way of assessment other than conversations and verbal questions.. so we’ll have our first quiz task sometime next week to see how this is coming along. I don’t regret the direct instruction, though. The kids are finding it valuable, and they’re enjoying the micro:bits and learning what they can do with them.  They want to make games such as pong and snake, and I think once we understand how to use the buttons, radio and accelerometer, they’re going to have a really good time making things they haven’t yet envisioned. I’m learning right along with them. They ask me a ton of questions and my stock response is “I just haven’t learned that yet. I guess we will learn it together.”

It’s fun though. It keeps you young.

Some of the younger students enjoying coding.

 

 

 

 

MinecraftEDU in the classroom: My first few lessons.

This semester, I’m teaching an enrichment class using MinecraftEDU. We have 40 minutes at the end of the day, every other day, for a semester.  In my class, I have seven girls and 21 boys, all seventh- and eighth- graders.

From the beginning, I told them that I had been reading a lot about Minecraft and playing some over the summer, and that some of my teacher friends felt it could be used as an educational tool, while others were not convinced. I wanted to test the idea that you could use Minecraft in education.

The plan is and continues to be that every day, we will either download an existing lesson from the Minecraft EDU World Library and try it and review it, or we’ll create our own lesson with an educational goal in mind.  Every day, a different student blogger will write about our experiences.

We have used several lessons from the Worlds Library and blogged about them here!

http://prestonminecraft.weebly.com/

After trying a few canned lessons, I created a world that was mostly empty except for border areas for groups of students, and chests with some building supplies such as stone, redstone, doors, levers, and lamps. I told the students I wanted to try a group building activity where they make an interactive learning experience using redstone. Perhaps a quiz with questions students can answer. I was vague about what I wanted, knowing what they gave me would be different than my expectations anyway.

I split the class into four groups and put them in this world.

2015-09-20_11.58.20

We reviewed, briefly, norms for how to act in a creative Minecraft situation, and worked for two class periods – along with opening and closing and logistical things, the students probably had 60 minutes of build time. This is what the world looks like now.

2015-09-20_11.56.06

 

Almost none of the students actually created an interactive quiz, but almost all of them did create something. Some of their creations, as you can see, are very creative and interesting. They’re learning new building techniques from each other and by trial-and-error.

There were some amazing things going on and some problems that I need to address.

Amazing things:

  • If students didn’t know how to accomplish something, they were resourceful in figuring it out. For example, one student wanted to create a display that shoots fireworks if you click the right lever. He researched how to make fireworks in Minecraft, gave me a list of supplies he needed, and planned the display. The student who created the waterfall display did similar research and gave me a supply list.
  • Students were constantly iterating on their designs and learning from them. One of my students said “I realized that you could click any lever and all of my lamps would come on, so I had to re-wire all of the redstone.
  • Students were teaming up and creating structures together. A group of three students made an underground house with redstone-activated doors and a labyrinth inside.

On the topic of problems I need to address:

  • I have one or two students who have decided to take on the role of griefers. I saw one doing Google searches on how to get around border blocks in MinecraftEDU, and then he took what he learned to enter other student areas and damage their structures. Another student would log off, log on under a different name, say bad words in the chat, and then log back on again. The class is very big, as you can tell, with 28 students, so I didn’t catch every problem right away. It created a very bad vibe.
  • When a student discovers building supplies stashed somewhere, their first instinct is to take them and use them to build. Groups of students complained often that their supplies kept getting stolen. I see this as a problem-solving opportunity so we can work out a system for you to have private areas to keep items you want later. Perhaps signs next to chests and a class rule about what to do when you see a chest that is labeled. Students asked me for Ender Chests which you can lock, but I hesistated, not knowing anything about Ender Chests. My own inexperience with Minecraft is a limitation at times.
  • I would say there can be cliques in the building world – for example, the girls tend to stick together and build separately from the boys, and the boys tend to team up with their close friends and ignore other groups. Community building, creating an atmosphere of trust and respect, needs to be done intentionally and explicitly, and I went into Minecraft building without doing enough of that up front.

This first creative world is clever and I intend to set up a day in which we have groups of students come in for tours of the redstone build. Students will have to create signs and arrows that show how to get around their creations and use them. By the end of the semester, I want students to create a world with missions that teach something of educational value and give other classes a tour through it.

This class is so weird. It’s messing with what I know about public schooling. Kids are so engaged and excited by it. I can’t point to many math or science or social studies standards that we can progressively understand by using Minecraft. Students seem to be having fun, working together, and making creative things. Is there educational value in just that? Could I measure the impact of Minecraft if I wanted to? Is this a valuable class?

Those are questions I’ll be thinking about as we progress here.