Skip to content

Commit f72c5e0

Browse files
committed
Update calibration math.
1 parent bca8770 commit f72c5e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/adxl34x_offset_calibration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
print("Raw z: ", z)
2525

2626
accelerometer.offset = (
27-
int(-(x + 4) / 8),
28-
int(-(y + 4) / 8),
29-
int(-(z - 250 + 4) / 8), # Z should be '250' at 1g (4mg per bit)
27+
round(-x / 8),
28+
round(-y / 8),
29+
round(-(z - 250) / 8), # Z should be '250' at 1g (4mg per bit)
3030
)
3131
print("Calibrated offsets: ", accelerometer.offset)
3232

0 commit comments

Comments
 (0)