2 # -*- coding: iso-8859-15 -*-
6 from datetime import datetime
10 s = i2c_read_reg(0x50, 0x10, 8)
11 hall1, hall2, hall3, hall4 = struct.unpack(">hhhh", s)
12 return hall1, hall2, hall3, hall4
14 if __name__ == "__main__":
15 i2c_write_reg(0x50, 0x90, struct.pack("BB", 1, 1)) # switch direction
17 i2c_write_reg(0x50, 0x1, struct.pack(">hhhh", speed, speed, speed, speed))
18 start = datetime.now()
20 diff = datetime.now() - start
22 print "%d.%03d: %d %d %d %d" % ((diff.seconds, diff.microseconds/1000) + status)
25 i2c_write_reg(0x50, 0x1, struct.pack(">hhhh", speed, speed, speed, speed))