App Development / Distance Learning: SpriteKit

It has been far too long, my friends. In challenging times like these, it's all the more important to help each other out.

We have been running classes for students at home for the past six weeks here in Vietnam. I want to offer the activities I've been doing and resources to you as you look for ideas to use with your own classes.

The first is App Development. This course is meant to be an open workshop class where students learn to code using Swift and build projects in Xcode and Swift Playgrounds. Needless to say, doing this when we are not in the same room has been difficult. I am used to running around the classroom and helping students resolve issues. This is much more difficult when we are not in the same room.

The most frequent mode of operation for class is the try-tweak-reflect cycle. I give students some code that does something, ask them to change something in the code, predict what will happen, and then reflect on the result. They do this a few times until they end up with something that is uniquely their own.

SpriteKit Activities

SpriteKit is a library in iOS that lets you create games. The best way to do this right now is the Swift Playgrounds app which is available for iPad and macOS. There are lots of things you can have students do. Here are some of the ones I've done with students. Feel free to use any of it. The app itself has some phenomenal activities that are ready to hand to students and get them learning from the start. If you want a bit more directed learning related to SpriteKit, read on.

I created a video that walks my students from start to finish in creating a simple SpriteKit app that moves a block around the screen with a tap. This was recorded all in the iPad Swift Playgrounds app using the screen recording feature.

SpriteKitStartToFinish (YouTube)

This next video led to something a bit more sophisticated with numbered circles falling and bouncing around.

AppDevelopment - Playing with Classes (YouTube)

You will want to start with this playground downloaded to your computer to use in Swift Playgrounds or Xcode.

After taking students through a few activities like this, I gave them a design challenge. Before we closed school, my plan was to have students build a game to spread awareness of an issue related to the UN sustainable development goals, or SDGs. Here is the description of the project I gave them. (Link here)

Students created some really neat stuff. It took a lot of remote debugging and use of Chrome remote desktop in some cases to make this work, but it was worth it in the end. Here are some highlights of student work:

Write me if you have any questions on how you might use this yourself or with students. We are in this together.

Color Following Robot - RVR, Adafruit Metro, Pixy2

One of the fundamental challenges in maker education right now is the reality that there are many different interesting tools available, but not all of them talk to each other. A notable change, however, is that many of them use open source software that makes it possible to understand how each one works. All that remains is connecting the dots.

About a year ago, I learned about the Pixy2 camera platform. This is an impressive device that can easily learn colors and deliver coordinates of those colors in a camera image through a number of different protocols. The example code is primarily provided through a series of Arduino projects. After working through some Arduino projects with my robotics class a year ago, I decided that barebones Arduino isn't the way to get students excited about programming microcontrollers. There are way too many semicolons, error-prone libraries, and finicky elements of the C++ language that get in the way of students being able to make things on their own. That said, the Pixy2 is incredibly versatile. It tracks colored blobs quickly and accurately.

Over the past year, I've also spent time in the CircuitPython ecosystem. The Adafruit team has done an amazing job of documenting their extensive line of boards (such as the Metro and Feather Express lines) and providing resources through CircuitPython to use these out of the box.

The other release last October was the Sphero RVR line. The first project I gave students a year ago was to build a motorized car using VEX motor controllers, a motorized platform, and an Arduino board. That was a lot more trouble than I expected, especially given that I wanted students to then use the cars they built with a Pixy2. That was a flimsy platform and I should have seen that from miles away. The Sphero RVR is packed with strong motors, a robust sensor assembly, and a solid hackable frame upon which other things can be mounted. This thing drives quickly and reliably, and that's after only a few months of being available. Commands can be sent to it through a serial port to get it to drive. As of now, the API is limited to driving at a given heading and speed, raw motor power control, and flashing LEDs.

I wanted to be able to demonstrate some concepts of control systems to my high school students. I also had a number of Pixy2 cameras available from my experiment last year. I also had decided that CircuitPython was the way to go for teaching students embedded microcontroller program using the Adafruit boards. It was time to combine these three resources to be able to build a colored object following robot.

After a lot of experimentation, I eventually ended up with the code linked below. The Pixy2 code is a modification of Robert Lucian's Python port of the API for use with a Raspberry Pi (I think). I did some work to adapt it to use the CircuitPython I2C functions, though it is not the complete feature set. The Sphero Python API is made for use with a micro:bit and MicroPython, but I switched out the code for the MicroPython serial port with that of the CircuitPython serial port on a Metro board. I had to comment out parts of both the Pixy2 code and the Sphero code that I wasn't using in order to get the code to fit on the Metro. I'm still not convinced that this was the problem as there appeared to be plenty of free memory available when I checked, but I had a number of MemoryErrors pop up without the code commented out.

Here is a GitHub repository with the code.

I'm sure this isn't as efficient as it could be, but I wanted to demonstrate the simplicity of using information from a camera as a way to build a control system for steering a robot. This is to help students understand a simple proportional algorithm as a control system. My hope is that students will apply this to autonomously steering a robot as part of this year's FIRST Robotics Competition game: Infinite Recharge.

Google Calendar and Appointments

Like some of my favorite people, I’ve been playing around with Google Scripts in earnest this year to make my teaching work easier. I did this most recently with Google Calendar.

You may or may not know that you can set up appointment slots on a calendar. This is really nice to for others to sign up for appointment times. Google provides a appointment sign up page, lets others book the slots out of those available, and moves booked slots onto your calendar. The only problem is that it requires that those booking appointments have a Google account and sign in. You can’t have a public appointments page that lets any non-Google user view and book a slot. For the purpose of setting up parent conferences, this is a no-go.

You can, however, have a public calendar page that does not require sign-in. The closest way to implement the appointment function would be to show a bunch of appointment slots on that public calendar and have parents ask for the slot that works best through email.

I wrote a script to make these slots. You enter the calendar ID, the start time for the window for appointment slots, the meeting length in minutes, and how many slots to make. The script does the rest.

function addAppointmentSlotsToCalendar(){
 var parentCalendarID = "enterCalendarIDHere"
 var parentCalendar = CalendarApp.getCalendarById(parentCalendarID);
 var currentDate = "October 21 2019" 
  var eventTitle = "Appointment Available"
  var startTime = "8:30"
  var duration = 15 //minutes
  var numberOfSlots = 8
  var startDateTime = new Date(currentDate + " " + startTime)
  var endDateTime = new Date(startDateTime.getTime() + duration*60000)
  var currApptTimeDate = startDateTime
  for(var i = 0;i<numberOfSlots;i++){
    parentCalendar.createEvent(eventTitle, currApptTimeDate, endDateTime, {description: 'This appointment time is available for meeting with Mr. Weinberg.'})
    currApptTimeDate = endDateTime
    endDateTime = new Date(currApptTimeDate.getTime() + duration*60000)


I learned some important things that didn't occur to me until parents started emailing me about the times.

The calendar needs to not only be public, but the event details need to be visible. Otherwise, the public calendar shows all of the slots, but they appear as 'busy'. This is in the calendar settings here:

The really nice feature that I didn't realize would work until I started receiving requests for times is filling appointments. All I need to do is change the calendar for the event from the public version to my personal one. This removes the slot from the public calendar and adds it to my own schedule.

I've had some fun figuring out how to use automation like this to manage my work this year. There is a lot built into Google Scripts that makes repetitive processes much easier, particularly for the sorts of things that teachers do all the time. I encourage you to find something that you do that might be improved by a script like this and make it a personal challenge to figure out how to do it.

The Two Clocks

The biggest change to my educational philosophy in the past fifteen years can be summarized by two images.

Image one:

Image two:

One instructional model insists on starting at the beginning and working right through to the end. You never have the complete picture until you've seen the process from start to finish. Even if you think you know what you're looking at when you're halfway done, you aren't really finished until you actually finish.

The other starts with a wide, blurry view. Structures are clearly there, but are not easy to describe. Over time, that structure reveals smaller structures, which then yields more structure, and so on. You can stop when there is sufficient detail to answer your question, but more time leads to even greater clarity and understanding.

One is part of our tradition. One is closer to how we learn outside of the walls of formal education.

One has worked for a long time; but who has it actually worked for?

On inefficiency

In the robotics and engineering class and app development courses I teach, there are a lot of group projects. I design the projects to be big enough that a single student cannot do everything.

That said, there are tasks though that a single person can do on his or her own. I always bring up the constraints of time and ask students to frequently reflect on whether the group's time is being used effectively. Three people all building a cardboard prototype for a rectangular box screams inefficiency to me. So does writing a project app from scratch when I have provided starter code to make things easier. 

From an assessment perspective, I want every student to take on every aspect of a project at some point during the semester. All of them should have a chance to write code, wire sensors together, do some fabrication, and test and develop the entire system. For a single project, things don't always work that way. We need opportunities to specialize too. 

I often need to step back within a single project and remind myself: knowing when to focus on one element, when to shift to a new one, and when to zoom out and look at the big picture - this is a skill. This skill develops over time and comes only from experience. Even adults need to be reminded (or forced) to change their perspective to effectively reflect on a process. We also need to be given opportunities to focus on a single task, leaving all others aside.

 Designing, learning, and making are inherently inefficient because the path to the endpoint is uncertain. Building something new and learning something new, are not about efficiency though. Even when we are following someone else's instructions to build a project, we might not have completed that project before. Thinking about efficiency is a useful reminder to make deliberate choices about our time. 

I asked a student about one of the classes this week. He wisely said "Mr. Weinberg, you should take the amount of time you think the project should take, multiply it by two, and then just relax. Give us time."

I often limit the time for projects because I want short design cycles. So far, the only thing that has accelerated progress is being up against a deadline. The learning that happens within that shortened time though is limited.  The rapid progress there is often because students have learned to use their materials.

Learning those materials requires inefficiency to come before it. I need to let that happen. I need to relax there.

Structures and Habits

My courses this year are AP Calculus AB, Robotics and Engineering Technology, and App Development. Given a lot of the work I knew in advance I would be doing this year, I made the explicit decision not to change the Calculus course much from what I did last year.

That leaves Robotics and Engineering Technology and App Development. I wanted both of these courses to be:

  • individualized - students would not all necessarily be working on exactly the same task as others, nor at the same level as others.
  • paced by task and student learning goals, not a unit calendar
  • centered on the process of making and creating 
  • limited in the amount of direct instruction required
  • assessed through documentation and communication of process, not skill level

There is one other critical design requirement that I want to mention.

Almost every course I have taught over my fifteen years has typically followed a gradual release of control model. Students typically start the year by following my directions closely under a lot of structure in the beginning. Then as they understand my expectations and follow my rules, I give a bit more independence to students over time. By the end of the year, we would be a close knit community that knew how to learn together.

I wanted this to be the reverse.

On the first day of each class, I gave students some ideas for what I hoped each of us could celebrate by the end of the semester. I was honest in saying that I didn't know exactly how we were going to get there.

I did say that each project would be an opportunity for students to set some goals, figure out what was interesting to them in the course of completing the project, and make course corrections as they made progress. Short design cycles would be important to doing this. There was never going to be enough time or enough resources to do everything. Playing and brainstorming, research, testing, and evaluation would all lead to some difficult decisions to be made along the way. That, after all, is the engineering process.

I decided that it was important to put this structure in place at the start, or I might just slip back into old habits. I admit after a few months of doing this that I've wavered at times, wondering if I've done the right thing. I've always come back to the fact that this feels like it is just what students need.

A New Chapter

I'm excited to share the redesign of my blog. The new site and name is to reflect my hope to focus on some different things moving forward in a shift in my role at school.

Previously, you've known me as a teacher of mathematics, physics, web programming, short, a teacher of lots of things. I've principally been a mathematics teacher through the first fifteen years of my career, and continue to do so by working again this year with students in AP Calculus AB.

The big change is that I am coordinating the STEM program for the high school at SSIS. Thus far, I've designed a fabrication space for the high school and have reworked two classes to be based on the engineering design cycle. I'll go more into detail on both of these courses in upcoming posts. I also spend my time attempting to model the making, design, and documentation process for students and colleagues.

The guiding principle for the engineering classes is that making things is the best way to learn - probably no big surprise for those of you that know me. I'm an engineer by training and a tinkerer at heart. I've learned a lot through my own projects and want to help students experience this for themselves. So far, it is going very well.

Stick around and I'll tell you all about it.

The Computational Thinker's Classroom - Workshop Video

I ran a workshop on computational thinking at the Vietnam Tech Conference this past March. My goal was to give teachers some new ways to think about classroom tasks and the deliberate use of computers to do what they are good at doing.

The general vibe of my talk was consistent with what I've said here in the past. Some highlights:

  • We should be using computers to do the tasks that computers do well. This frees us up to do those tasks for which we are well suited.
  • Insisting on basic skills as the entry point for learning is an easy way to put students on the sidelines. Computers are often how we as professionals answer questions that are important or interesting to us. We should help students understand how to use them in the same way.
  • Spreadsheets, databases, and visual models like Desmos and Geogebra are great entry points for computational thinking. You don't have to be a coder, a mathematics or science teacher, or a technology expert to build these activities for your students.

The video is here:

If you want to do the first three activities yourself and see other resources from my workshop, visit There is a fourth activity on the page that is mentioned at around 24 minutes in the video that is linked there too.

As always, I'd love to hear what you have to say.

Reminders for Myself

Students can go online and see more than enough videos about completing the square to require me to be the one to write steps for them.

Students can (and often do) seek tutoring outside of class to learn shortcuts to solving the most common problems.

Students can look up code that has been written before.

Students can memorize when I ask them not to do so, and choose not to memorize when I want certain knowledge to be locked in long term memory.

Students can pore over a textbook, often alone, and learn everything that might be tested on an exam. They might understand how to make connections on all sorts of scales, levels, and manners of organization with no input on my part or on the part of another student.

Given that all of these things might be true:

  • My classroom should be a place that maximizes the potential a whole group of human brains all trying to learn something new in the same space. The things we do together should respect the fact that we can do them together.
  • The focus in my classroom should be on the difficult parts of learning. Experiencing and overcoming confusion is a natural part of learning. So is trying something, failing, and learning why that something led to failure. Having good people around during this process lessens the blow. That is why we are there together.
  • I am an expert in identifying the ideal next step in the learning process for an individual, a group, or a class. I am an experienced learner. I've been there. Sharing and calling upon that experience is how I add value.
  • I should outsource instruction for those students that can learn without me. I can teach directly when students need me to do so, but this is not as frequent as I might first think. I should provide as many different resources as possible and encourage students to choose the ones that would best help them make progress. Pride when I am that resource, and disappointment when I am not, are not important. The classroom is not about me.

The structures and systems should not punish students for actions from the first list. The structures and systems in the classroom should support the goals in the second list.

Making Sense of Stories

I love stories. They capture my attention in pretty much any situation in which I find myself, and I don't think I'm the only one. Story telling has always been an easy way for me to capture the attention of students in my classroom. Each story I tell usually shares a snapshot of my life outside of the classroom. In calculus, I tell the story connecting integral calculus to the way I pester my mom by drinking glasses of chocolate milk with increasingly smaller spoons. I tell graduating seniors my story of never feeling like high school was actually over until I experienced eye-lid twitches immediately after my flight took off at the end of the summer en-route for my new college home.

I use stories as pedagogy too; there is something satisfying about talking about number sets as a series of successive inventions introduced to address the mathematical needs of humanity. Counting sheep, signed integers for money, measurement and immeasurable numbers. My intention in doing so has been just, or at least it has felt just up through fifteen years of teaching. The idea is that we start with the most basic elements of mathematics by counting, and then just add complexity as we attempt to account for the rest of what we see in the universe. If we start with the basics, and if we build up our understanding continuously from the basics all the way to the highest levels of mathematics, we are doing right by our students. As our age or number of years in school increases, the complexity increases alongside to match. This, after all, is often what traditional mathematics course sequences have always done.

The concept I confront fairly frequently is how much I disagree with the inverse of this progression. That if we do not start with the basics, then we will not get students to understand increasingly more complex material. This is most often the conversation around students that have gaps in their understanding. We can lament those gaps as teachers, and though my colleagues have always sought ways to help students across them, they can lead to conversations that make me uneasy. "Student A is not ready for X. He can't factor a quadratic."

The main reason I object to this argument is that it leads to a number of issues around course offerings and their structure. I believe curriculum most frequently becomes bloated because of the demands of courses that come after them. Colleges demand X from high schools, so high schools add to their course offerings to match those expectations. This means that high schools demand Y from middle schools, middle schools expect Z from elementary, and so on. I've argued about this mismatch of expectations about the basics across the levels in a previous post.

I am not just concerned about this in the context of mathematics.

My high school US history class twenty years ago made it to the civil rights movement in the 1960s. One could argue that understanding the 1960's requires that we understand the entire story of what happened before it. Maybe we could have moved faster over the entire year so that we could have made it closer to present day, but I don't think my teenage brain would have been able to handle a higher speed.

Must a physics class always start with one dimensional kinematics? Must we do projectile motion algebraically to really understand it?

Stories usually have a beginning, a middle, and an end. If the story of school mathematics always starts with algebra, has geometry and more algebra in the middle, and the end is calculus, students will always be waiting for us to push them forward through the curriculum because as teachers we aknow the story. In traditional timeline based history, we know what happens next because it's the next day or month in time, or the next page in the book. In chemistry, everything is made of atoms, so we have to first build atoms from subatomic particles, then combine elements into compounds, then combine compounds into reactions, and so on.

The other thing that really good stories do, however, is start exactly when and where they need to start. This is not always at the beginning of the action, when things are simple and easy. Good stories expect the audience to trust the medium to provide necessary details along the way. There is backstory, there is foreshadowing and detail and confusion - all deliberately baked in to capture our attention. This is not to say that our job is about entertaining our students. I believe that making sense of what students see in front of them is more important than adhering to a traditional notion of what is basic.

We don't have to construct a car from bolts and sheet metal in order to learn to drive it.

We don't have to understand that water is a polar molecule to understand that it freezes into ice. At some point though, understanding this might help us understand why it ice floats. It's our job to make that knowledge necessary.

The pathways we craft for our students do not have to start at the very beginning of all knowledge or content. They can start with an interesting starting point that leads to questions. They will be confused at first to figure out where they are, what is going on. This is an opportunity to teach knowledge to help students work their way out of this confusion. We can start at the big picture level and dig deeper as increasing complexity demands it. I think teachers broadly understand this on the individual class level, but that this often gets lost in conversations of curriculum or course sequence. We need to be doing more to build our courses to have more experiences like this.

I really think those of us in content based subjects need to talk to our colleagues that teach art. Their courses are often equally dense and skill based, but they take an approach to learning and analyzing that is much more along the lines of being plopped down in an alien environment, shown something novel and unique, and being expected to ask questions. What do you see? How does this make you feel? What questions do you have about what you see? Why did the artist make this choice? How did the artist achieve this result?

There are basics to be taught, but they rarely need to be the starting point.

This is where the biggest shifts in my understanding of this job have occurred over the past fifteen years. Stay tuned.

1 2 3 31