mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-12-22 21:45:48 +00:00
Update lis3dh.py
This commit is contained in:
parent
f9082650ea
commit
2468ac039f
|
@ -104,9 +104,9 @@ class lis3dh:
|
||||||
for D in [X,Y,Z]:
|
for D in [X,Y,Z]:
|
||||||
MSB = D >> 7
|
MSB = D >> 7
|
||||||
if MSB == 1:
|
if MSB == 1:
|
||||||
res = -128 + (D - 128)
|
res = (-128 + (D - 128))/(128*self.resolution)
|
||||||
else:
|
else:
|
||||||
res = D
|
res = D/(128*self.resolution)
|
||||||
new_values.append(res)
|
new_values.append(res)
|
||||||
return new_values
|
return new_values
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue