An Arduino library to simplify reading values from the GY-521 gyroscope, accelerometer, and temperature sensor. Shortens code and makes it much more readable. Get raw sensor values or processed data in SI units (m/s^2, degrees, celsius) with simple to use functions!
Here are the available functions and their purposes.
- sensor_init()
Initializes device for communication. Absolutely crucial to initialize the device in the void setup() function. - get_raw_accel_x()
Returns acceleration value in the x-axis as measured by the sensor. - get_raw_accel_y()
Returns acceleration value in the y-axis as measured by the sensor. - get_raw_accel_z()
Returns acceleration value in the z-axis as measured by the sensor. - get_accel_x()
Returns acceleration in the x-axis in m/s^2. - get_accel_y()
Returns acceleration in the y-axis in m/s^2. - get_accel_z()
Returns acceleration in the z-axis in m/s^2. - get_raw_gyro_x()
Returns value of rotation in the x-axis as measured by the sensor. - get_raw_gyro_y()
Returns value of rotation in the y-axis as measured by the sensor. - get_raw_gyro_z()
Returns value of rotation in the z-axis as measured by the sensor. - get_gyro_x()
Returns angle of rotation in the x-axis in degrees. - get_gyro_y()
Returns angle of rotation in the y-axis in degrees. - get_gyro_z()
Returns angle of rotation in the z-axis in degrees. - get_temperature()
Returns temperature at the sensor in degrees celsius.
There are two ways to install this library.
- Launch the Arduino IDE
- Navigate to Tools > Manage Libraries...
- Search for "rdv-gy521" in the query bar.
- Install the latest version of the library
- Download this repository as a .ZIP file
- Launch the Arduino IDE
- Navigate to Sketch > Include Library > Add .ZIP library
- Find .ZIP file on the Finder menu and select choose