This is an integrated MEMS Accelerometer and Gyroscope unit that is so popular and can be easily attached to Arduino.
The unit uses I2C protocol.
In the first example from Arduino website, we can read data and show it on the serial monitor application in Arduino IDE.
In the second project, you can read data from the unit and view data on Processing.
This project is brought to you from Arduino create website.
Here is the code for the project:
And as another source of a project using the same unit GY-521, here it is:
You can download Arduino code, connect the project, get Processing code and then run it on http://sketchpad.cc
Project Schematics is just the same as the previous project. I repeated them to make things easy:
Get Arduino Code from here
Get Processing Code from here
Check our books on Amazon we created on our way to find happiness.