Code for PS2 controller using library created by Bill Porter.
MPU6050 code for arduino by Jeff Rowberg.