Skip to content

Commit e327712

Browse files
committed
correcting_returning_units
1 parent d9a8a05 commit e327712

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

adafruit_lsm9ds1.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS1.git"
3636

3737
import time
38+
from math import radians
3839

3940
try:
4041
import struct
@@ -303,10 +304,10 @@ def read_gyro_raw(self):
303304
@property
304305
def gyro(self):
305306
"""The gyroscope X, Y, Z axis values as a 3-tuple of
306-
degrees/second values.
307+
rad/s values.
307308
"""
308309
raw = self.read_gyro_raw()
309-
return map(lambda x: x * self._gyro_dps_digit, raw)
310+
return map(lambda x: radians(x * self._gyro_dps_digit), raw)
310311

311312
def read_temp_raw(self):
312313
"""Read the raw temperature sensor value and return it as a 12-bit

examples/lsm9ds1_simpletest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"Magnetometer (gauss): ({0:0.3f},{1:0.3f},{2:0.3f})".format(mag_x, mag_y, mag_z)
4141
)
4242
print(
43-
"Gyroscope (degrees/sec): ({0:0.3f},{1:0.3f},{2:0.3f})".format(
43+
"Gyroscope (rad/sec): ({0:0.3f},{1:0.3f},{2:0.3f})".format(
4444
gyro_x, gyro_y, gyro_z
4545
)
4646
)

0 commit comments

Comments
 (0)