Hungry for humbler Pi? Check out kid-friendly LED-laden Pibrella
Cyntech/Pimoroni GPIO add-on board sets Raspberry Pi alight
The main event
Just as the Pibrella library incorporates pre-defined noises, it also includes some set light patterns, including fades and blinks, which can be applied to each of the LEDs, so there’s some ‘my first project’ fun to be had here.
The four inputs and four outputs all feature both positive and negative terminals, effectively giving each one its own GND terminal. Like PiFace’s outputs, Pibrella’s outputs have activity LEDs to tell you when something is happening, but so do the inputs.
Attention to detail: the Pibrella has a pad to sit the add-on on the Pi’s capacitor
Watching out for, and responding to, occurrences has a deeper meaning with the Pibrella. What particularly appealed to me, as a programmer, is that the Pibrella introduces users to event-based programming techniques: the notion that code simply responds to external actions. This is, of course, how apps for modern operating systems are programmed: they do little or nothing until the user interacts with the UI, or data comes in from the network, say. But it’s not a common approach with embedded devices, such as Arduino.
The Pibrella introduces this, in a small, ‘ease you out of the shallows’ way, through a number of its library functions. These take the name of a function which will be called when a certain event takes place – if it ever does.
So rather than poll a pin to see if the Pibrella’s red button has been pressed, there’s a function,
pibrella.button.pressed(), that waits until the button is pressed and, if it is, calls another function – a ‘callback’, in the jargon – you’ve defined and passed to
Serious and not-so-serious: PiFace Digital (left) and Pibrella
changed() function, available to any of the board’s eight IO pins, once registered with a callback function, will wait for the nominated pin to change its state and then call the named function.
To be fair, a lot of the event monitoring functionality comes from the regulation
RPi.GPIO module for which the Pibrella library is a much more newbie-friendly wrapper. But top marks to Pimoroni for putting event-driven programming on the agenda in such a non-scary way. Understanding how this technique works is a big step toward being able to program desktop and mobile operating systems effectively.
The Pibrella: not a toy but worth toying with
The £10 Pibrella is a nice little Pi add-on for young kids and it’s a fine basis for programming lessons where a teacher wants children to write code that makes things happen in the real world, rather than on-screen.
Older novices may find it appealing too, for the same reasons, but I suspect that once they’ve worked their way through the sample programs – which won’t take long – they’ll put the Pibrella aside and start working on more complicated projects with resistors, wires, motors and stuff.
That’s not to say such projects can’t be connected to a Pibrella, but that new Pi users growing in confidence are going to want to interact with their machines more directly and, not to put too fine a point on it, want to work with kit that looks a little less like the result of a kid’s electronics kit toy.
The Pibrella isn’t a toy, at least not entirely, but in hardware terms it’s a step to more interesting things, not a destination in its own right. Just make sure you take advantage of its entry into the world of event-driven programming on the way.
This review first appeared at the Tech Tonic blog. The author asserts his rights.
Sponsored: Data Loss Prevention & Data Theft Prevention