Coding with Kids Doesn't "Bug" Me!

One day my daughter will be putting my code to shame, and I can't wait.

Coding with Kids Doesn't "Bug" Me!

If you follow me on Twitter, you may have noticed a couple of tweets over the past day or so about CodeBug. I've got an itch to say more about this product and the topic of teaching (my) kids programming, but I don't want to flood Twitter... plus it feels like I'll need more than 140 280 characters.

What Got Me onto This Topic?

My eldest daughter's school has a robotics/coding curriculum. They have a teacher whose job it is to visit every classroom with various robots that the kids get to play learn with. She has always said how much she loves this part of her school week.

At our latest parent-teacher interview we got to see her use a pair of Bee-Bots. These little bots have buttons on their back that your use to program in a pattern of movements and then press go to execute them in sequence.

Afterwards I asked if she would like to do some coding at home on the computer with me. She jumped at this (and has been reminding me that I had suggested it for the past few weeks.)

I'd considered using something like Scratch, a block based language, as something we could do on the computer. However, I had a hunch that my kid may get more out of this exercise if she could see the results of her coding in "the real world."

This meant lights, buzzers and possibly servos...

This May Not Be My First Rodeo

I have a feeling the reason I was so keen on have a physical aspect to this endeavour was due to a past experience. A few years ago, I built a prop bomb for my local Airsoft group.

This bomb was based on a PICAXE 20X2 microcontrollers and a couple of 4094 shift registers (for the LEDs.)

The prop would take 30 minutes to "explode", as the time progressed a bar would light up across the top and a buzzer would go off. The buzzer got faster and faster as it got closer to the end of the countdown.

During an Airsoft game, one team would plant and activate the prop, and the other team would have to get to it and defuse it. This meant holding the red button for 30 seconds.

What's not shown in this (very old) video is the pair of air horns that fired off to announce the "explosion." Those things were seriously loud, you didn't want them going off while you were in the middle of defusing.

I bring all this up because I have fond memories of hacking out some code and not knowing for sure that it will work until it was loaded up, and run, on the PICAXE. Watching LEDs blink and buzzers sound, hoping like hell that 30 minutes later the "explosion" would go off as coded.

Fostering the Coding Bug

After a bit of searching, and considering a Raspberry Pi, I settled on CodeBug. This board started life on [Kickstarter](Fostering the coding bug) back in 2015. It features an online IDE with a Scratch like language called Blockly, and the resulting code can be downloaded and loaded up on the bug.

Transferring your code over to the CodeBug is as simple as this sort of thing gets. Hold down the A button while plugging in the USB cable and it shows up in Windows as a standard mass storage (USB) device. Drag, drop, done.

This simplicity is the main reason I chose it. It's also a cute little device (it looks like a bug, obviously) and has a few good first party add-ons, such as cases, LED stars and "GlowBugs". I'm not linking to each of these, they'll come up at whatever retailer you're looking at for a CodeBug, but it means there are a lot of cool options.

First Project: Name Badge

This morning, after numerous inquiries as to when we'd start coding, Ella and I settled in at the computer to get to work. Her first project was a name badge which scrolled the letters of her name across the 5x5 LED grid.

I let her take prime position in front of the desktop and I setup my chair over to the side (furthest away from the mouse so I didn't try taking over!) She took to the interface like a duck to water.

Check out her finished code here:

And a video of it running on the CodeBug itself:

I Don't Know What I'm doing!

I'm no teacher, but I hope I can help shepherd my daughter through some programming concepts. I mentioned above I specifically sat so that I couldn't take over the mouse and do things for my daughter.

All of the blocks in her code were chosen, dragged, and snapped together by her.

How the session would go is along the lines of asking her leading questions and then giving her the keyword she was looking for in the list of options. For example, once she realised her code ran once and then terminated this exchange happened:

Me: Remember how I said it starts at the top, works to the bottom and ends? Do you want it to go back to the top and show your name again?

Ella: Umm... yes.

Me: That's called a "loop", can you see loop? Good work, what do those options say?

Ella: "Repeat 5 times" or "Repeat while true"... what does that mean?

I'd then explain the difference and what she could change about the first option. If you noticed her counting in the video, that's because at the time it would repeat on a button press 10 times. She was making sure it worked!

What's Next?

Tomorrow morning we're going to work on a dice roller. Ella is likely to be getting an introduction to variables and random numbers (unless she figures out some other way to do it!)

We've also got alligator clips ready to go to hook up headphones at some stage and make some sounds. I'm sure we will continue to make this a regular thing.

One day she'll be putting my code to shame, and I can't wait.

Related Article