Converted and integrated C accelerometer code into rest of project