Keeping physical computing simple

I love Scratch. I think it’s actually under-rated as a way of teaching computing, even in secondary schools (KS3). I remember a long time ago someone on the BBC ‘Computer Programme’ defending BASIC with the words ‘it’s a bad workman who blames his tools’, and I think the same applies to Scratch. You can do a lot with Scratch, more than I think some people give it credit for. If you can do a bubble sort or build a simple or complex working Enigma machine, it’s quite a flexible programming language.

But I want to do some physical computing with my KS3 students. I excitedly read news about the new version of Scratch bundled with Raspbian Jesse with GPIO hooks built-in – but then I looked at the sample code and blocks…

Scratch GPIO on Raspberry Pi

Ouch. The broadcast messages to make the GPIO pins work – to light LEDs, poll switches etc – look really complex. So complex, in fact, I think they totally defeat the point of using Scratch in the first place.

I’ve already decided Python will be our text-based language of choice as we introduce computing to the curriculum, so I’m incredibly excited by a project called GPIO Zero created by Ben Nuttall of the Raspberry Pi foundation and others. This is a Python library designed to make physical computing on the Raspberry Pi under Python as simple as, well, it should be. Look at this code:

Using GPIO Zero Python library

That is the entire code needed to turn an LED on and off in a loop. Pretty impressive.

Playing with GPIO Zero

I had a play and hooked 3 different LEDs up to a Raspberry Pi and got them all blinking in turn and then lighting up together in a matter of seconds. Very promising, and I am increasingly convinced that Python is the way to go for teaching computing in KS3.

gpiozero python code

This entry was posted in computers, Raspberry Pi and tagged , . Bookmark the permalink.

Leave a Reply