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
36a7d87bb0
commit
e32e5f93b3
|
@ -67,8 +67,10 @@ class lis3dh:
|
||||||
prepare_z = smbus2.i2c_msg.write(self.addr, [0x2C])
|
prepare_z = smbus2.i2c_msg.write(self.addr, [0x2C])
|
||||||
status = smbus2.i2c_msg.read(self.addr, 1)
|
status = smbus2.i2c_msg.read(self.addr, 1)
|
||||||
self.i2c.i2c_rdwr(check_status, status)
|
self.i2c.i2c_rdwr(check_status, status)
|
||||||
#while status.buf[0] != 0b1111:
|
while status.buf[0] != 0b1111:
|
||||||
# sleep(0.00001)
|
sleep(1)
|
||||||
|
self.i2c.i2c_rdwr(check_status, status)
|
||||||
|
if status.buf[0] == 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)
|
||||||
|
|
Loading…
Reference in a new issue