mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-11-10 01:35:50 +00:00
Update lis3dh.py
This commit is contained in:
parent
c3403bd47d
commit
6c0806a377
|
@ -77,11 +77,12 @@ class lis3dh:
|
||||||
print(status.buf[0], "\n")
|
print(status.buf[0], "\n")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
self.i2c.i2c_rdwr(check_status, status)
|
self.i2c.i2c_rdwr(check_status, status)
|
||||||
if status.buf[0] == 0b1111:
|
if (int.from_bytes(status.buf[0],"big") & 0b1111) == 0b1111:
|
||||||
self.i2c.i2c_rdwr(prepare_x, x)
|
self.i2c.i2c_rdwr(prepare_x, x)
|
||||||
self.i2c.i2c_rdwr(prepare_y, y)
|
self.i2c.i2c_rdwr(prepare_y, y)
|
||||||
self.i2c.i2c_rdwr(prepare_z, z)
|
self.i2c.i2c_rdwr(prepare_z, z)
|
||||||
X = int.from_bytes(x.buf[0],"big")
|
X = int.from_bytes(x.buf[0],"big")
|
||||||
Y = int.from_bytes(y.buf[0],"big")
|
Y = int.from_bytes(y.buf[0],"big")
|
||||||
Z = int.from_bytes(z.buf[0],"big")
|
Z = int.from_bytes(z.buf[0],"big")
|
||||||
|
print(X,Y,Z)
|
||||||
return [X,Y,Z]
|
return [X,Y,Z]
|
Loading…
Reference in a new issue