In this section, I'll attempt to explain the code I wrote to control the arm. I started with a really simple program, as shown on the simple example page. Have a look at this first, particularly if you're not familiar with C++ programming. The simple example also shows how to get everything setup to compile and run the program, which is largely the same for the full arm program, so I won't repeat it all again here. There isn't much code needed to get a few servos moving with the Raspberry Pi. But as I added the ability to save a set of programmed steps and get the arm to run through them, the code quickly grew. For this reason I split out the code into multiple classes and files. If you're new to Object Oriented Programming, classes are just a way to group together related code and reuse it. I've spent some time tidying up the code and adding comments to explain what it all does, so hopefully it's mostly easy to follow.
You can download a zip file containing the full code here. Unzip the file into a folder on your Raspberry Pi and follow the instructions further down to compile and run the program.
The code is made up of the following files: