Skip to content

Commit 26b1821

Browse files
authored
Switch example to acceleration property
1 parent 28b77c6 commit 26b1821

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/accel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
# Loop forever printing accelerometer values
3333
while True:
34-
# Read accelerometer values (in gravities or G). Returns a 3-tuple of x, y,
34+
# Read accelerometer values (in m / s ^ 2). Returns a 3-tuple of x, y,
3535
# z axis values.
36-
x, y, z = lis3dh.read_accel_g()
37-
print('x = {}G, y = {}G, z = {}G'.format(x, y, z))
36+
x, y, z = lis3dh.acceleration
37+
print('x = {}G, y = {}G, z = {}G'.format(x / 9.806, y / 9.806, z / 9.806))
3838
# Small delay to keep things responsive but give time for interrupt processing.
3939
time.sleep(0.1)

0 commit comments

Comments
 (0)