diff --git a/adafruit_mpu6050.py b/adafruit_mpu6050.py index 3b97fba..f317717 100644 --- a/adafruit_mpu6050.py +++ b/adafruit_mpu6050.py @@ -16,15 +16,17 @@ **Hardware:** -* Adafruit `MPU-6050 6-DoF Accel and Gyro Sensor - `_ +* `Adafruit MPU-6050 6-DoF Accel and Gyro Sensor + `_ (Product ID: 3886) **Software and Dependencies:** * Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads + * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice + * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register """ @@ -34,6 +36,7 @@ __version__ = "0.0.0-auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MPU6050.git" +from math import radians from time import sleep from adafruit_register.i2c_struct import UnaryStruct, ROUnaryStruct from adafruit_register.i2c_struct_array import StructArray @@ -274,9 +277,9 @@ def gyro(self): gyro_scale = 16.4 # setup range dependant scaling - gyro_x = raw_x / gyro_scale - gyro_y = raw_y / gyro_scale - gyro_z = raw_z / gyro_scale + gyro_x = radians(raw_x / gyro_scale) + gyro_y = radians(raw_y / gyro_scale) + gyro_z = radians(raw_z / gyro_scale) return (gyro_x, gyro_y, gyro_z) diff --git a/examples/mpu6050_simpletest.py b/examples/mpu6050_simpletest.py index caf392e..3bdf165 100644 --- a/examples/mpu6050_simpletest.py +++ b/examples/mpu6050_simpletest.py @@ -10,7 +10,7 @@ while True: print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (mpu.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (mpu.gyro)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f rad/s" % (mpu.gyro)) print("Temperature: %.2f C" % mpu.temperature) print("") time.sleep(1)