if you're doing a pendulum, a much simpler solution is to make a variable resistor or potentiometer. The idea would be the pendulum would swing back and forth and the end of it with the weight would always be in contact with a metal strip with some resistance. One side of the strip is positive, one side is ground, and then you measure the voltage on the pendulum (which is also grounded)
the idea is that at center, voltage would be half. When it swings one way, the voltage will be almost full, and the other way will be almost no voltage. If you're using a micro controller with a AD port then you can easily program it to read the data you want.
use a very high resistance strip too, so that less current is drained from your source and it doesn't heat up a lot.