Tag Archive | middle school

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.

 

 

 

 

Advertisements

Review/Extension Activities for Looping and Conditionals

More than once I’ve finished or half-finished a lesson knowing that some kids understood most of it, some really didn’t get it at all and I didn’t get enough information during class to really understand where I should go with things the next day. If you back up and review, you bore the kids who understood already and run the risk of teaching the same ineffective way you did the previous day. If you plow ahead, you will really lose the students who were barely understanding the day before.

In this situation, I sometimes do a code-analysis card sort.  I write a handful of code snippets and produce output from them. Mix up the code and outputs, partner up the students and ask them to match code to output. It takes less than 10 minutes, and then you have a whole-class discussion where you ask groups to report out. What’s a match you feel confident about and why?  What is a match that gave you trouble and why?

Here are a couple of my card-sorts from this year’s CS Exploration course, in which I have been teaching Processing.

Function Match:

example card from the function card sort.

example card from the function card sort.

In this card sort, there are four function definitions, four function calls, and four descriptions.  The students’ job is to match a definition to a call to a description. Before making copies, I put a letter (A,B,C,or D) on each function defintion, a number (1234) on each call, and a symbol on each description.

https://docs.google.com/document/d/1sEnnMD7T4i_AxqfIyosZ2VCBZOkbtU7yx79fNbBqGNI/edit

The card sort is really simple because each function has a different number of parameters. If a student can recognize that the definition with three parameters matches the call with three parameters, they can do the sort. But it creates good discussion when you talk about why the matches work, what the parameters mean, and how we know the descriptions match the definition and call.

I also created a Function Kahoot! quiz to do before or after.

https://play.kahoot.it/#/k/0aa8f906-3de9-41be-8b9f-ce5b9ced5e97

 

Next I have a card sort on looping. It only focuses on While loops. The task is to match the code with the output.

loop1\

The cards are here:

https://docs.google.com/document/d/1f-OGnz_jCIv_Zh2iNDY0XpTQbK1VjUYTLr9gzh7PHn0/edit

Again before I make copies, I label the code with letters and the outputs with numbers to make it easy to report out what matches the students made.

The discussion on this sort usually hits on two ideas. Is the x-coordinate or y-coordinate changing, and how do you know? How do you know how many times the loop will run? Good tie in with some linear algebra here – the starting value has some connection to y-intercept and the increment each time has a connection to slope or rate if you choose to go there. There is one card that will freeze the program because it gets stuck in an infinite loop, and it’s an important one to discuss as I always have students that take some time to understand the idea of the infinite loop.

 

I also have a Kahoot! quiz on variables and expressions, without loops/conditionals or anything like that. Might be a good review activity.

https://play.kahoot.it/#/k/3ef963cc-0ceb-4c83-9616-fa7c714698f1

I’m working on adapting some of my older Kahoot! quizzes from the Khan Academy Processing JS to the stand-alone Processing, but here they are if you are interested in the Khan version.

Khan Kahoot! on conditionals and booleans:

https://play.kahoot.it/#/k/62584d63-7484-4490-bb23-019c8ee1a7e0

 

I had this one to quiz students on the draw() loop and how it affects variables. I don’t think I’ll adapt it for Processing but it might be useful to someone.

https://play.kahoot.it/#/k/10a75250-560d-4550-a202-b936149173dd

 

 

What are some of your ideas for differentiation, discussion, extension and review?

 

Teaching event-based programming – a traffic light

Recently as I was looking through my blogroll, I read Mark Guzdial’s review of the K12CS.org Framework. I wished I had been able to review the framework with a group – I didn’t feel that I generated great ideas about it on my own, but I did like reading Mark’s. Reading my social media feed sometimes impacts what I’m going to teach. In this case, Mark made a point about models of computing:

Great research by people like John Pane at CMU has shown that novices think of programs as responding to events, being reactive (e.g., think apps, games, GUI interfaces). Thinking of computing as input-processing-output is an older model, difficult to understand, and less common today.

 

Huh. I had been teaching programming as input –> do stuff –> output and wondering to myself what to do when this model broke down. I never really thought about how I teach event-based programming differently. I decided I would give it a try, though. In my 7th-8th grade CS class, my kids had learned about variables, conditionals, and functions. Normally I would plow right into iteration but I decided to take a detour and do some activities with the kids on event-based programming. We did a couple of examples working in Processing with draw() and mouseClicked() and keyPressed(). I decided to introduce an activity involving a state machine to teach the difference between linear programming and event-based programming.

I talked with the kids about how many of us think a traffic light works. We see it as a linear set of steps.

trafficlight_maya

trafficlight1

But in reality, we know the traffic light has a set of sensors. And when a sensor is tripped and other conditions are met, then the traffic light advances to the next state. You can model the state with a variable. In this case, I used “lc” for light color. We can model the sensors with button clicks and key presses.

trafficlight2

We wrote this program together, imagining that the mouse click simulates a timer expiring, and the space bar simulates the sensor that detects your car. I did this as a teacher-led launch. Kids followed along and ran their programs. Easy.

http://www.openprocessing.org/sketch/311664

 

The kids asked about how you simulate a real timer. In Processing, there isn’t an easy implementation of a “delay” function, so you have to poll for a timer. There is a built-in function millis() that returns the number of milliseconds since the program had started. The kids played with the millis() function and had fun writing the time to the screen. So for the next class, I decided a program that used timers would be a good extension and problem-solving activity.

In the second class, we looked at this state machine model.

trafficlight3

My amateurish drawing shows looping arrows where you are polling the timer. As long as the “ready” variable, for example, is 0, then the light stays the same. As soon as the “ready” variable changes to 1, then you can advance to the next state. You can check for “ready” by doing some math on variables that store the value of millis(). One variable stores millis() over and over again. Another variable only stores millis() when the state has just changed.

I put the kids with a partner and made this a pair programming assignment.  We reviewed the norms of pair programming. I gave them a starter program that just showed a red screen and used the millis() function to display the elapsed time. I had some variables in the program but did not tell the kids how to use them. Their task was: turn the program into a timed traffic light. It should turn the red light on for a certain time, then the green light for a longer time, then the yellow light for a very short time, and then go back to red.

This is the starter program.

// 0 is red, 1 is yellow, 2 is green 
int lc = 0; 
int ready = 0; 
int oldms; 
int newms; 
int elapsedms; 
int interval; 

void setup() 
{   
  size(400,400); 
  ready = 0; 
  oldms = millis();
  newms = millis(); 
  elapsedms = newms - oldms; 
  interval = 5000; 
}
void draw() 
{
  if(lc == 0) 
  { 
    background(255,0,0); 
  } 
  else if(lc == 1) 
  { 
    background(255,255,0); 
  } 
  else if(lc == 2) 
  { 
    background(0,255,0); 
  } 
  newms = millis(); 
  elapsedms = newms - oldms; 
  textSize(30); 
  fill(0,0,0); 
  text(elapsedms, 150,150); 
} 



The kids split into pairs and started working. After a while, a few groups were close – they could check for a certain elapsed time and then change the light’s state variable so it switched colors. They didn’t know how to reset the timer, so after about 20-30 minutes, most of the kids could change red-green-yellow and then didn’t know how to get back to red.

So I did a catch-and-release where we talked about the polling loop.  I showed boxes that represented the values of “oldms”, “newms”, and “elapsedms” each time through the draw() function. Some kids figured out on their own that the way to reset the timer is by assigning “oldms” to millis() when you change the light’s color. Others figured out different solutions  and it was interesting to see what they came up with.

The activity took most kids until the end of the class. On the third class, I asked all of the pairs to copy and paste their programs into OneNote. I then called up several groups to do a walkthrough of their solution. They did a really good job presenting. I like OneNote for this kind of sharing because the rest of the class could copy the code and run it to understand what the presenting group did.

Here are some of the solutions! I liked how each group approached it a little differently. Some used my variables and some made up their own. Some used nested “if” statements and some used complicated boolean expressions. Some reset the timer after each state change and some waited until after a complete cycle of the traffic light.

Luke and Andrew’s Method

Anna and Kay’s method

Ryan and Parker’s method

I enjoy seeing the students have their lightbulb moments, and it’s also fun to have the overachieving students that can’t resist being a little creative with their programs.

Maya’s Traffic Light

Ben and Anthony’s Traffic Light with car (it stops on red, goes on green, and speeds up on yellow)

I liked this workshop model with the teacher-led launch, the worktime in pairs, and then the student-presented summary. I think it was a good problem-solving activity for the kids, and for me it was a nice departure from the input-stuff-output model of programming.

 

 

 

Arduino Final Projects by Middle Schoolers

This was my 3rd semester teaching an Electronics class for 7th and 8th graders, and I’m learning more and more every time I teach it.  In this class, I want students to learn the basics of electricity, circuits, and programming – and I also want them to learn a maker mindset. How to invent, remix, tinker, recover from setbacks, persist through difficulties, use your resources, collaborate with others. How to teach yourself what you need to know. How to present your project to others so they can build on it and make it even better.

I use some formal lessons, but this class is not as structured as a programming or computer science class. For the most part, students are given resources and inquiry questions, and they use the resources to teach themselves what they need to know. Everyone starts in a different place. Everyone has different needs. I want them to create something challenging that they’re proud of – a launching point for future exploration and learning in the world of invention.

I love the projects the kids made! Many made interactive holiday displays, and I got a great variety of others including videogame-themed projects, an LED cube, games, and even a car.  I created a simple Google Sites page to showcase their work.

sigourney4

MIDDLE SCHOOL ELECTRONICS FINAL PROJECTS

I also have some reflections on the semester and the class in general. The learning is just as good for me as it is for the kids.

  • Purposeful learning: I believe in giving the students a good foundation in circuits such as understanding measurements and parallel and series circuits. However, students report to me that they find the beginning of the class “boring” and I don’t think I connect it well to the Arduino projects later. I’ve been involved with a project called Engineering Brightness, spearheaded by Tracey Winey, our media specialist, and John Howe, our assistant principal. It’s part extracurricular and part co-curricular, where students build lanterns in our school’s makerspace to send to third-world countries. My kids get involved with the EB program through soldering lessons, field trips, and guest talks and Skype sessions, but it has not been fully interwoven into the class up to this point. Tracey and I have been planning to co-teach this coming semester – we’ll use the EB project to teach basic circuitry and the innovator’s mindset, and infuse cultural/global awareness into Electronics class. I’m really excited about making this partnership stronger. The kids will understand the circuitry much better with this style of learning. Imagine learning about serial and parallel circuits, volts and amps by designing your own lantern for other people. They will love what they’re doing and find it more purposeful. There’s a good body of research that shows this is how to draw girls into engineering, too.
  • Open-source culture: The open nature of Arduino is what makes the platform so beautiful to work with. I have encouraged students to remix found projects and to share their work, but haven’t really tapped into the community to make their sharing more real. One thought I have here is that there is a style of communication that comes with sharing projects. Look at good projects you find on instructables.com, or ehow.com, or youtube or any of the Arduino sharing sites. Look at some that are not as well done. There’s a structure and a style that makes your project accessible, interesting, replicable, and fun. Kids in the modern world need to learn to communicate in the medium that best suits their work, to code-switch and adapt their style as needed. I wonder how to teach open-source sharing and communication to middle schoolers. I would love to make the writing and video editing and photography and commenting a really key part of the class, as I’m not satisfied with the work I’m getting at the moment. It would be so important for the Engineering Brightness part of the curriculum as well as the Arduino part.
  • Appropriate level of challenge: I ran into challenges you always run into with a project-based class. Some students got in over their head and tried to do too much. Some kids who were perfectly capable of finding answers on their own raised their hands many times each class and waited for me to help them. Some finished early with a half-baked project that didn’t meet requirements but did not want to challenge themselves further. Work was shared unevenly between partners. Some finished early and asked me what they should do for the next three class periods. Some pushed the deadline right up until the last minute of the last day of class. Some did not understand how to read rubrics or project guidelines. I expect all of these challenges each semester, and sometimes I do a good job working with these situations, but not always. I continue to look for good structures for project-based learning. It’s really hard with one of me. This may be a great opportunity for me and my teaching partner next semester to put some good practices in place for the kids.

 

Computer Science Education Week at Preston

I’m late blogging about this because our days were so busy with CS Ed Week! I owe a huge debt of gratitude to my partner in crime, Tracey Winey (Twitter: @premediawine) , who listened very nicely when I said “I have some ideas about Computer Science Education Week I’d like to brainstorm with someone”, and she agreed to dive right in and plan a bunch of activities with me. She’s an outstanding organizer and is becoming a darn strong engineer as well, so the world better watch out.

We arranged for teachers to do an Hour of Code with their students over the course of the week, in their regular classes. Many students are doing multiple Hours of Code and they love it. The three activities garnering the most positive feedback from students are the Minecraft Hour of Code on code.org, the Anna and Elsa Hour of Code on code.org, and the BitsBox Hour of Code (which actually lets you download your apps to your mobile device!). I love how the Hour of Code makes coding accessible and fun for every student. Tracey and I wanted to infuse coding into a little bit of a cultural celebration at school. We envision that students should not see coding as a niche activity for a geeky few, but as a normal problem-solving tool that everyone uses.

We set up some open houses in the media center and scheduled students to come to them and take tours. We arranged for current CS and Electronics students to be tour guides and take their friends around different “exhibits” having to do with computer science. Tracey managed the open houses as I had classes to teach during most of them. We had:

Interactive Code, Art, and old Video Games on Monday:

That is PONG, people.

That is PONG, people.

Arduino Day on Tuesday:

Experimenting with a reaction-time game and a pac-man simulator on Arduino.

Experimenting with a reaction-time game and a pac-man simulator on Arduino.

Robot day on Wednesday:

Students love NAO robots and Lego EV3 Robots.

Students love NAO robots and Lego EV3 Robots.

Minecraft day on Thursday:

An Hour of Code with Minecraft Turtles in the lab. Very popular workshop.

An Hour of Code with Minecraft Turtles in the lab. Very popular workshop.

On Friday, we had our first annual Preston Middle School Code-a-Thon. I blogged about how we envisioned it working previously.  We were able to accept almost 80 kids, and it came down to 11 beginner teams and 8 advanced teams. The beginner participants were mostly girls, and the advanced groups were half girls. It was busy but a lot of fun.

We recruited some adult volunteers from the community… some Preston parents who are engineers, along with some engineer friends and retired teachers, and a staff member from the Larimer Humane Society. We had four judges and eight technical mentors, and we divided them up to work with beginners or the advanced teams.

Tracey and I gave a presentation about the code-a-thon. We talked about how code-a-thons are also called hackathons, and they are engines of innovation. Google is famous for its hackathons, and hackathons usually have a theme – Virtual Reality, Rural Life, and Social Services are a few. Sometimes, employees even stay overnight and bring their sleeping bags, and code through the weekend to come up with their solution. Everyone presents at the end. We presented the theme:
Animal Welfare!  The kids were very excited. We showed this quick YouTube clip to get the students thinking about different problems they could solve related to animal welfare.

The kids started by brainstorming, and Tracey set them up all over the media center with SMART boards, regular whiteboards, a SMART table, a Kapp, butcher paper, desktop computers and laptops. The kids had to choose a problem or a need to address, and what language they would code in. I had set up some group accounts on Khan Academy, Open Processing, and Scratch. One group of students chose to use MIT App Inventor, one chose BitsBox, and three groups decided to create coding solutions using the NAO humanoid robot.  We offered snacks every hour, and had the kids turn their programs in using Google Classroom. They worked from 8:15 until 11:15, and then they gave presentations to the judges. We saw programs on animal abuse, factory farming, saving penguins, catching poachers, endangered animals, quite a few perfect-pet quizzes, a vet program, and a robot dog trainer. While the judges were deliberating, our Humane Society volunteer gave a presentation about what they do and how they help animals in the community. Finally, the judges returned and we gave out top-four prizes in each category.

It was awesome. The kids who gave us feedback said they loved coding something that had a purpose to it. That they really enjoyed having a reason for coding, learning and being social and of course having snacks. I heard from a couple of parents of beginners that their kids were so proud of their coding and had so much fun. Many kids asked if we could do it again. We are pretty exhausted – but we probably will!

Here is a link to many of the programs created by students during the code-a-thon.

STUDENT PROGRAMS

I hope you like this slideshow of the code-a-thon. We had a great time!

This slideshow requires JavaScript.

First Annual Code-a-Thon for CSEdWeek

Computer Science Education Week is quickly approaching, and this year we want to go a little beyond the classroom hour-of-code events (which we are still doing). My school has decided to host its first mini-hackathon, which we’re calling a code-a-thon! I have seen announcements for hackathons in my area before and the idea is always intriguing, but I’ve never actually attended one – so this is a big leap, hosting one without ever actually seeing what a hackathon is like. Our awesome media specialist and I are pulling it together and hoping to learn from the experience.

Here is what we have decided so far.

  • We will have two categories: Beginner and Advanced. Beginners can be complete newcomers who have never coded before. Advanced coders have a semester of computer science or the equivalent.
  • Teams will be 3-5 students.
  • First thing in the morning, we’ll make introductions, set up norms, and reveal the theme. The theme will be very broad (the examples I use with students are “sports” or “space exploration”).
  • Students will have 20 minutes or so to brainstorm what they would like to make.
  • They can make anything they want as long as it has to do with the theme, and it is created with code. Any coding language is fine. We will provide access to robots and Arduinos if they wish to use them. Students can use Scratch or Code Studio, or Python or JavaScript or any other language. Web design tools such as Weebly do not count as “code” but can be used to enhance their project. Some ideas include games, interactive flash cards, simulations, trivia, animations, educational programs, etc.
  • We will provide some technical mentors that can help students. Students will get a token or a flag they can turn in to receive a certain amount of time with a technical mentor. They should use it when they really need it!
  • We’ll have breaks for snacks and drinks and movement.
  • Students will get to present their projects to the judges for a short amount of time (3-5 minutes depending on number of teams).
  • Judges will score projects in these categories: Problem Identification / Requirements, Usefulness of Solution, Creativity, Teamwork, and Technical Quality.
  • Winners will receive prizes. Everyone will get food and publicity.

I teach a required sixth-grade tech class so I’m able to pump it up and give the code-a-thon some good publicity in class. I have also appeared on the morning announcements to advertise and give computer science trivia questions. I set up a table at lunch with some signs and sign-up forms.

The turnout was amazing! 116 kids signed up!  63 of them were girls! We are going to need to actually cut some kids from the code-a-thon… what a bummer, but what a great problem to have!

Signing up for the code-a-thon. Groups of friends registered together.

Signing up for the code-a-thon. Groups of friends registered together.

We’re excited to see how the event goes and what kinds of programs the students create. My vision is to create a culture at the school where computer programming is seen as a normal problem-solving tool used by everyone, and not a fringe activity for supersmart kids. I’m so, so encouraged by what I have seen with the code-a-thon signups. Really fun to see kids round up friends at the lunch tables and bring everyone over to register to spend a morning coding. I hope the event goes well, and I will definitely post updates as we get closer!

 

MinecraftEDU: The teacher struggle is real

A great deal of our discourse in the educational technology community is around how to use Minecraft in the classroom. It’s a fantastic creative tool and very engaging. I’m Minecrafting at home with my daughters and often find myself excited to get home and start working with them. Minecraft is an open platform with endless opportunities to modify and hack… and some of the latest innovations that have my attention actually use Minecraft to interact with the real world… just wow. I can’t wait.

I teach electives and enrichments, and I’ve been piloting using MinecraftEDU in a couple of my classes to see how I like it and what I could teach with it. I have my enrichment classes using creative mode to create missions and lessons that are educational, so we can upload them to the MinecraftEDU world server. I got my Robotics class to program ComputerCraftEDU Turtles to be their helpful companions in a world where they cannot build, and learn about programming and physical computing this way.

It’s been good. But it’s also been a struggle, and as I’m finishing up the week before Thanksgiving break – a normally busy time anyway that doesn’t always bring out the best in teachers or students – I have plenty to reflect on.

Think about all the things you don’t like about your students or your own kid when they’re playing video games. The obsession and tendency to tune everything else out. The desire to go on side missions that seem more engaging than the real objective. At times, the anger and temper flare-ups. Think about natural tendencies of middle schoolers outside of video games that are hard to manage. Tattling. Bullying. Inability to use words in a conflict. Stubbornness. Seeking revenge. I believe in Minecraft as a creative tool and I am struggling with the reality of managing 30 adolescents on a server at the same time. I give them challenging work – it causes interpersonal problems and I am still learning the tools of managing those.

MinecraftEDU does give you important tools to manage your students. You can freeze and teleport individual kids anytime. There are border blocks, so even if the kids are in creative mode, you can confine them to a certain area. You can turn on and off their building power, and use “build allow” and “build disallow” blocks to limit where they can build/dig and where they can’t.

You can turn off fire, TNT, Player-vs-Player, and animals and monsters. You can always see logs of the chat and who was on the server at a certain time, and I know Minecraft even keeps logs of what blocks were placed and removed, where and when. These are helpful, but kids are more resourceful and determined than you give them credit for. Every boundary is one that can be pushed.

Here are my MinecraftEDU struggles laid bare.

The very feature of Minecraft that makes it so universally interesting, its openness and hackability, can also be a downside in an educational setting. I paid for licenses for my school but found that kids could easily copy the MinecraftEDU directory on a flash drive and paste it onto their own laptops, giving them a free version of Minecraft EDU. I wish this were fixed. It should not be so easy to pirate the software. I actually found today that kids from outside my classroom were logging onto the classroom server and griefing students in my class. I’m in a position now of needing the ability to password-protect the server and changing the password every day as a result.

I have a few students who yell and rage at video games. I have a couple of kids who are sensitive and they cry. Great kids who are still learning appropriate emotional control. This feeds other students who find it funny and do mean things. Little things. They break a block or two, or steal a couple of items from a chest, or just walk into or next to their area and stand there. I don’t even see them do it, I just hear the angry children yelling and crying. Super mean, right? We have normed around appropriate Minecraft behavior multiple times, at the beginning of the unit and every couple of weeks since then. Problems still crop up and you will still have to deal with them.  I always wish I had more tools to do this. I can tell the server is keeping logs of  who is placing, removing, and crafting at each time and position, but I would love a teacher tool to open the correct log and search by username so I can find evidence of what happened and who was involved – this would be so nice when having that hallway conversation with kids and would eliminate the he-said-she-said dynamic. It also doesn’t seem to save the log if the server crashes. Or maybe it does. Again, tools to view the log files would be really helpful.

I also would really like a sort of limited creative mode, where I can have them use unlimited numbers of certain blocks but not others. It would let me give kids power to make a house but not necessarily an army of Iron Golems. I could apply limited-creative mode to students as needed, or apply it to everyone and gradually release to creative mode if all is going well. Filling the screen with chickens? You must be on limited creative mode, creating with only oak and brick, until we can have a chat about Minecraft citizenship. Another helpful feature would be a teacher request tool. Right now my system for kids getting help from me is to have them write their username and help request on a sticky note, and I keep a line of sticky notes next to me. I work on the sticky notes in the order received. This also means I’m not monitoring the chat or student positions while I’m working on help requests, and bad behavior goes unnoticed.

Ultimately though, kids need to be explicitly taught about video game citizenship, and very few are perfect at the interpersonal side of multi-player gaming. Minecraft is about much more than building and creativity and problem-solving. I went into it excited about the creative aspect and have been quickly brought back down to earth – there are boring and uncomfortable and otherwise not-fun lessons the students need to learn about working in this virtual society. I’ll need to spend just as much energy creating a positive culture in the class as I do creating building challenges. If there are videos or discussion guides or other interactive resources for doing this, I am a very willing audience.

 

Learning to Code in MinecraftEDU with Turtles

I haven’t posted about my Minecraft class / experiment in a while, but this has been a really interesting class to work with. My Minecraft class is a 40-minute period every other day, for a semester. Our enrichment period is not graded and is intended to be a time when teachers and students learn something interesting together. For example, teachers have classes on knitting, beading, Lego robots, ultimate frisbee, fly fishing, creative writing, and film. I have Minecraft. I wanted to use the class to explore the question “what can you learn from Minecraft?”

Since I’m a CS teacher, one interesting teaching tool that jumped out at me was the ComputerCraft mod (See a Video here) and the Turtles. I could see them as a unique introduction to programming and computational thinking. I had my class do the Turtle Island mission (which took four classes) and Turtle Canyon (which took two).  We enjoyed these pre-created missions. As a busy teacher, I was happy someone else took the time to create them and that they were so engaging and interesting for the kids. Many of the kids “died” multiple times and just kept trying to use their turtles to solve the puzzles.

The spawn point for Turtle Island. We had to install the CustomNPC mod on everyone's machine before we could use it, but the payoff was worth it because the characters help you with the missions and give you rewards.

The spawn point for Turtle Island. We had to install the CustomNPC mod on everyone’s machine before we could use it, but the payoff was worth it because the characters help you with the missions and give you rewards.

Next, I downloaded a world from the server that had ten building areas (Actually, it was this Volume Challenge with the extra buildings and things removed). I assigned the students to a numbered area with a small group. The world was set up so the students could not build or dig – but turtles could. I filled their inventories with supplies and gave them a short program to copy, and for three or four classes they could build whatever they wanted with the turtles. When you give middle-schoolers a prompt to “build whatever you want”, you get some fascinating things.

Many students used turtle remote mode almost exclusively. Some wrote very simple programs. But then some got a little more courageous with programming and made some interesting things with the turtles.

Houses, farms, pyramids, a strange creation of black wool, all made by turtles.

Houses, farms, pyramids, a strange creation of black wool, all made by turtles.

One group seemed to have a program to build a level of a house, and they ran it twice to get this weird structure with floating walls. Another group had a program to create walls and another program to create stairs. They ran this program anywhere they could.

One group seemed to have a program to build a level of a house, and they ran it twice to get this weird structure with floating walls. They also leveled their ground with the turtles. Another group had a program to create walls and another program to create stairs. They ran this program anywhere they could.

Most of the programs were very simple, but I did see some experimentation with nested loops, and with programs calling other programs. I wonder what kind of reasoning skills we’re building here. Why 19? Why 40? So many questions.

2015-10-28_18.03.10

Nested “Repeat” blocks in the graphical turtle language in Minecraft. This program uses move and place blocks to build… four walls?

I am currently teaching some turtle lessons to my Robotics class, justifying it by telling myself “they’re virtual robots”!  This has some advantages over real robots – no parts to throw or break, for example. This is a graded class and so I have to approach it differently. I’m still working out how I am going to assess their knowledge of robotics principles via Minecraft. I will create a final project assignment. What should the guidelines and expectations be for a Minecraft robotics project? I am making the class more academic by including lessons like this one.

WARM UP LESSON ON TURTLES

Kids used the link above and analyzed the programs, and made predictions about what they do. Then I opened Turtle Canyon and found each of the turtles with the programs in the document, and we ran them. We took another look at the code to match what the turtle did with the code. The group discussions helped me understand the programs a lot, and I hope to see the robotics kids being more adventurous with their coding as a result of the lessons.

You learn other things too, besides programming – and it’s what makes Minecraft such a confusing, but enriching, world to play in. I love it when lessons are nice and tidy and you have a certain goal and you’re laser-focused on that goal. But in Minecraft, you have to stay flexible with your goals. Some days, you’ll learn about robotics. On some days, you will learn anger management. Some days, teamwork. Some days, resource management. Self-advocacy. Information literacy. Conflict resolution. General persistence and resourcefulness. So I have to keep in mind that if a kid didn’t make much progress with programming, it was because their learning was happening in another area.

I leave you with this picture of my pixelated students interacting with their turtles building a house.

Turtles... so darn cute and programmable

Turtles… so darn cute and programmable

Booleans and Conditionals – Lessons and Reflections

Ask a CS teacher about a main goal of their course, and a lot of us say we want kids to be able to plan and write a program independently. And that it’s a discouraging but real part of the job that many don’t.

I really take that mission seriously, and as a result I move really slowly through topics.  I’ve mentioned before that I take weeks just to teach variables. This post contains a sampling of some of my lessons on booleans and conditionals.

Lesson 1: Structure and purpose of boolean expressions and conditionals.
Objectives: Identify the boolean data type and describe the rules that govern booleans, including logic operators.
Identify and describe the structure of the “if” statement.

We started by analyzing code samples and then modifying them – first with a partner, then whole-class. I created one that introduces the boolean data type and another that uses a variable and an “if” statement to simulate a coin toss.

CODE SAMPLES FOR ANALYZING

That said, I’d love to have a protocol or a structure or organizer for code-analysis problems. If you have one you like, I hope you share it!

Lesson 2: Prisoner’s Dilemma

Objectives: Use boolean expressions and conditionals to create a program that models a situation.
I love this lesson and have blogged about it before here.  Kids used Processing standalone instead of Khan Academy this year, but the task was pretty much the same. This is a pair programming activity. The “release of responsibility” is very gradual.

Lesson 3: Button Clicks

Objectives: Describe an area of the screen with boolean expressions.
This lesson has a very clear mapping to Common Core math standards. In Algebra, students are introduced to solving inequalities and also systems of equations. Later in high school math, students move to solving systems of inequalities.  When you create a clickable button, you’re describing the coordinates that are included in the ‘button’ as a boolean expression, which maps nicely to a system of inequalities.

Here’s the starter program.

http://www.openprocessing.org/sketch/231512

http://www.openprocessing.org/sketch/231512/embed/?width=500&height=500&border=true

We start with the mouseClicked() function incomplete and discuss as a class how to finish it. We look at the coordinates, height, and width of the rectangle and consider some x,y coordinates that are inside the rectangle… and some that are outside. Then we try to come up with a general sentence for which coordinates are always inside the rectangle. The x-coordinate must be between 150 and 350. The y-coordinate also must be between 200 and 300. If all of the conditions are true, you have clicked inside the box. If even one is false, you have not clicked in the box.

Then I give the kids a challenge:  create two buttons, one in the upper-left quadrant, one in the lower-right. Make something “happy” happen when you click one of the buttons, and make the other one produce something “sad”. They made some clever creations and had fun with it.

Alex P’s “Two Button Task”

Lesson 4: If/then quiz

The “quiz” task is individual, so at this point the students no longer get to work with a partner and must create a program solo. I make this task easier than the pair programming tasks, with the goal of every kid writing their own program from beginning to end.

This task is pretty simple but ended up requiring some good thinking from the kids.


 

In a sports tournament, the tigers will play the lions, and the eagles play the hawks. The winners of these two games will play in the championship.

These 4 variables represent the scores in the first game.
int tigers;
int lions;
int hawks;
int eagles;

Write a program that will write the names of the two teams playing in the championship. If there’s a tie in either game, you should write a message explaining that the game goes into overtime.


Although it’s a quiz, if a student raises his or her hand, I help. I help by asking questions – something I studied hard at when I was a math teacher.  The goal of the questions is to determine just how much help they need and give only that. Ask:

  • Read the problem to me again. What do you understand so far?
  • Where did you get stuck?
  • Under what condition would you write “tigers win”?
  • What causes a tie?
  • Tell me your best idea so far?
  • Can you translate that into code the computer can understand?

By the time the quiz comes around, there are definitely still misconceptions all over the place and it takes time to work through them all. Some of the ones I run into:

  • Writing a boolean expression in words, such as “tigers less than lions”
  • Mixing up > and < signs
  • Confusing equality (==) with assignment (=) operators
  • Not closing text strings with quotes (shows more than just a syntax problem – they’re not seeing the text string as a single entity)
  • Confusing the variable name with text (e.g. lions vs. “lions”)
  • Not yet understanding the purpose of variables as an “input” to the problem that can change. for example, a student may write this code, which renders their variables pointless:
    lions = 14;
    tigers = 10;
    if(14 > 10)
    { text(“lions win!”,50,50);}
  • These are misconceptions where the students are, at some level, not getting the point of a CS concept. Mistakes abound also such as syntax errors. These are different kinds of problems and have to be treated as such… I have a couple of students who generally get the CS concepts but they make tons of syntax errors. I have no problem looking through their program for the semicolons and spelling errors and just fixing them quickly. A kid who is not getting a concept, though, needs more questioning and more work.

When I taught math, one of our big ideas in 7th/8th grade was the “two-step linear equation” and how to solve it. I learned over time there are no shortcuts to mastering this concept. Sometimes there were many kids in the room who just needed me to sit with them, and one on one, watch them solve the problems in great detail and give them feedback on that work. These early programming tasks require the same attention from me. Many students just need me to sit with them, one on one, and talk with them as they program and solve. It’s a time-consuming task – in the moment, you think to yourself this lesson clearly bombed – the kids can’t program independently and I’m just doing damage control. But I have noticed as I have taught this age group more, that the early work pays off by the end of the semester. By the time kids are done with the class, you give them a simple task with conditionals and they just pound it out with barely any effort. Even the struggling learners do learn to program independently. It just takes more time and practice and attention for some kids than others.

 

Using NAO in the classroom

This year, our school bought a couple of new ‘toys’ for the classroom, to be used as little ambassadors for CS and physical computing: twin NAO robots. During 1st quarter, I used them to do mini-lessons with the 6th graders to teach them about various programming concepts, and teamwork, and to have a little fun. They are very engaging devices. I think some of the kids fell in love,  and I got many inquiries about whether they could take more computer classes to continue working with NAO.

nao1

They’re not easy robots to learn. They work with a language called Choregraphe, which is a block-based language with wires like LabView. If you dive into the blocks, there is Python code. My huge CS teacher confession is that I have never actually learned Python. It looks straightforward, but it’s overwhelming to add the new text language on top of the block language and other technical issues that came with programming the NAO – booting it up, connecting it to a network, understanding the center of gravity and the fall sensors, and so on.

 

 

nao_code

Choregraphe software.

But as with everything else, I knew I would never actually learn the robot unless I had a compelling reason to, so I told my Robotics Engineering class we were going to put away the Legos for a few weeks and do a unit on NAO programming. I don’t know if I came off as knowing what I was talking about. I told them we would make the robots dance and use the sensors and do a project. They needed no convincing.

For the first project, I used the little NAO curriculum that Aldebaran sent us, and put together a tutorial on how to make the robot dance. I divided the kids into groups and asked each group to create a short dance sequence of 10 seconds or less. We would string all of the sequences together into a long class dance.

It ended up being a really interesting activity. It exceeded my expectations.

The students created their dance moves in the virtual robot in Choregraphe, and then had to test it on the live robot. If the robot lost its balance and fell over, I made the students fix the program and bring it back when it would run without the robot falling.  It took quite a lot of time for the kids to take turns on the real robot, so if your program didn’t work, you made fixes and it could be a half hour before you could try it on the robot again.

Lots of care had to be taken with the virtual robot... easy does it with speed and range of motion.

Lots of care had to be taken with the virtual robot… easy does it with speed and range of motion.

However this created a really interesting problem-solving dynamic. Kids are used to getting instant feedback on what they try – through online math exercises, games, quizzes – the “gamification” of education is a powerful motivator. But when the feedback wasn’t instant, they were motivated by quality and care – not speed or trial-and-error. I remembered when my dad said he had to create punchcards for his programs and then fly them to Kansas City to be compiled on the punchcard reader. Talk about a long feedback cycle – his punchcards had better be perfect or else the trip was wasted! Similarly, after the kids saw their programs failed once, I rarely saw them fail twice. They brought the programs back after more thorough testing and analysis showed they would not make the robot fall over.  I saw some very careful work going into every frame of movement so the robot would stay standing.

So while I love the ideas behind gamifying your classroom, I believe there’s something to be said for activities that reward precision and diligence rather than instant gratification.

 

Making sure the dance moves are stable.

Making sure the dance moves are stable.

 

I don’t know if I could articulate what skills or concepts I was teaching the kids, but the lesson created some excitement and suspense. It was also really difficult for classroom management. Once a group was done with their dance moves, some kids caused a little trouble with each other – horseplay and such. I was consumed with unzipping files and bringing them into the Choregraphe software, and giving feedback to the kids, so I let things be more rowdy than I was comfortable with.

I’m totally building this plane as I’m flying it. I am learning a lot more this way than if I were exploring with no urgency or purpose, but it’s stressful. The next lesson I will do with the kids is to have them make a speech-recognition program that has the NAO ask trivia questions. I will blog about it then!