Code For Auto Stabilizing Arm

Does anyone know where this guy got the code for this? It's amazing! I'm looking to do the same exact thing in my project. From the looks of it he probably typed the code up himself. Anyone want to share links to code that may achieve the same outcome?

For good reading on the subject, look up search words - PID controller -. It's not exactly simple though.

The guy used info from this topic Arduino Forum in designing the project.

roboticfan101:
Does anyone know where this guy got the code for this?

I expect he wrote it.