Step 9: Arduino Software
The Arduino sketch is attached.
Comments: I used the stepper motor library for the stepper motors. I 'borrowed' this interface from another Instructable or off the Internet but can't remember where. There is an abundance of information on driving stepper motors, though.
The accelerometer zero values for North-South(Y) and East-West(X) have to be determined for each fixture. My plan was to store the ‘zero’ values in EEPROM so the fixture could automatically calibrate itself and store the zero values in EEPROM. But I couldn’t get this to work. So I settled for a version that could autocalibrate and find the zero values but it wouldn’t save them if power was lost or reset. The next step explains how to calibrate the zero values.