This time, we’re going to explore how to do the same thing programmatically. I’m going to walk you through developing a C library to control the GPIO – but exactly the same principles could be used in any other language.
Why C? Well, mostly because I like C. But proficiency in C is useful if you’re going to be working with embedded systems, and microcontrollers; so it’s a good language to use. I’m also picking C because there are a lot of tutorials & libraries using Python – and few (if any) working with C. None of which is to say that Python isn’t a great language (and if you don’t know it – then I highly recommend learning it too).
The Raspberry Pi (in case you’ve been living under a rock for the last six-months) is a cheap ($25) ARM Linux computer, primarily designed to be used to help teach kids to learn programming & computer science.
It’s also makes a pretty nice alternative to something like a BeagleBone, if you’re looking to play with some embedded computing technology. Whilst it’s less powerful than BeagleBone (and has less GPIO connectivity), Raspberry Pi does have a few advantages. It’s cheap, and it has an HDMI output – meaning that you can interact with it directly, without the need to ssh in from another computer.
The whole ethos of the Raspberry Pi foundation is to make the device as easy to use as possible: to encourage children (and adults!) to play with it, and learn to program. As with Arduino though, this user-friendly layer doesn’t mean that you can’t get your hands a little dirty and see what’s going on underneath.