Enginursday: Visually Programming Arduino

Visual programming languages are a unique way to introduce tyro programmers to thinking like a programmer. Here are some of the great tools we've discovered that enable visual programming for Arduino.

I got my first taste of programming with RCX Code and an old Mindstorms RCX 1.0, so maybe it's nostalgia speaking, but I really admire visual programming languages for their ability to introduce younger folks to programming. With color coded operators, geometrically shaped data types, and no semicolons (!), visual languages have a unique ability to make programming a more intuitive experience. And with the (admittedly necessary) annoyances of syntax removed, more of your programming focus can be directed towards solving the actual problem.

On the National Tour, and just browsing the Internet, this is a form of programming I've been encountering a lot lately. So, in this week's Enginursday post, I wanted to introduce a couple of exciting visual programming tools that are specifically geared toward the physical computing we love.

ArduBlock

A month or so ago, a coworker of mine (hi Brian!) showed me a beta release of ArduBlock. ArduBlock is a programming environment designed to make "physical computing with Arduino as easy as drag-and-drop."

ArduBlock Screenshot

It's really neat how ArduBlock ties the visual, drag-and-drop programming into actual Arduino programming. The software acts as a "tool" for the Arduino IDE. After drawing up your sketch and hitting upload, the software simply parses your block diagrams and turns it into real Arduino code. Then it compiles and uploads to your board normally. You can scroll through the generated code, compare it to your visual code, and even make your changes there. It has a lot of potential to be an amazing educational tool.

ArduBlock gets bonus points because it's an open-source project, with development ongoing (last commit days ago!). In less than a month, the software has grown by leaps and bounds. It's a project that's continually improving. If you're looking for a nifty, graphical alternative to Arduino programming, I'd encourage you to check ArduBlock out!

On the National Tour, I've had a few chances to see ArduBlock in action. In a workshop last weekend at the (seriously amazing) 'Iolani School, we had the opportunity to lead both teachers and students in programming the LilyPad ProtoSnap Dev Board using ArduBlock. The workshop was a great success -- seven hours of programming, zero compiling errors. It didn't take much instruction before the students quickly took off on their own, creating cool projects like a tap-input metronome, "monster detector," or a miniature police siren. ArduBlock allowed the kids to focus everything they had into creating rather than debugging, and that's what makes visual languages so special.

Scratch For Arduino

There are a a variety of visual languages out there, and Scratch is near the top of the list, turning kids into budding animators and game designers. But (unless you have a PicoBoard) it's tough to integrate with LEDs, motors, real-world sensors, and the like. Enter Scratch for Arduino...

S4A is a forked version of Scratch proper. The sprites and animating tools are still there, but there are also digital/analog I/O blocks, motor controls, and streaming updates from the analog inputs.

S4A Screenshot

S4A differs quite a bit from ArduBlock. It uses a firmata-type of protocol to interface between actual executed code and the Scratch program you've drawn up. There are pros and cons there: Written code takes effect instantly, but you're always tethered to the USB port. For any kids who are already better Scratch creators than I'd ever be (which is a lot, judging by what we're seeing on the tour), S4A is a perfect sidestep over into the physical world.

Thoughts?

Visual languages aren't for everybody or every situation. As a "text" programmer, learning ArduBlock proved frustrating at times. There are some constraints (the "repeat"/for loop can only initialize a variable with value 1, and increment by 1 each time) and annoyances (arrays references begin at 1 instead of 0) to get used to, just as with any language. But they still seem like an amazingly powerful tool to introduce beginners of all ages to programming and critical thinking.

Are there any other visual programming tools out there we could be using alongside S4A and ArduBlock in our educational pursuits (Labview?)? With tablets, and touchscreens taking the world by storm, are graphical languages something us text-programming dinosaurs need to adjust to? Any other thoughts on the subject?