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
2468ac039f
commit
3ff2e4eece
|
@ -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))/(128*self.resolution)
|
res = (-128 + (D - 128))*self.resolution/128
|
||||||
else:
|
else:
|
||||||
res = D/(128*self.resolution)
|
res = (D*self.resolution)/128
|
||||||
new_values.append(res)
|
new_values.append(res)
|
||||||
return new_values
|
return new_values
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue