Accelerometer and Arduino

Hi guys,

I was wondering if anyone would be able to help me out with a design project I'm working on.

I'm trying to figure out how to wire up a circuit with a 2-axis accelerometer and a dimmer for a light. I want the light itself to swing, and as it does, the voltage to increase and decrease corresponding to the microGs recorded by the accelerometer.

He's an example I found but I have no idea how to start this. Measure pendulum with accelerometer - Paja

Any help would be great.

Thanks heaps!

Mark

/ 2010 mlab.taik.fi/paja
// Pendulum using MEMSIC2125 Accelerometer

//pin to read x axis value
int memsicXPin = 8;
//pin to read y axis value
int memsicYPin = 9;
//pin to + pin of Analog In pins in the DC controlled dimmer.
//- pin goes to GND.
int pinLamp = 11;

pin connection already given

Thanks AMPS-N

I'm pretty new to this. Do I simply copy and paste that code into arduino and as long as my circuit has been wired up correctly, it'll work..?

Would anyone be able to draw up a circuit for me!? / show me what it looks like?

Mark