8from smbus2
import SMBus, i2c_msg
11 bus.i2c_rdwr(i2c_msg.write(address, cmd))
13def set_max_acceleration(motor, accel):
15 0x9C, motor, 10, accel & 0x7F, (accel >> 7) & 0x7F,
16 0x9C, motor, 12, accel & 0x7F, (accel >> 7) & 0x7F])
18def set_max_deceleration(motor, decel):
20 0x9C, motor, 14, decel & 0x7F, (decel >> 7) & 0x7F,
21 0x9C, motor, 16, decel & 0x7F, (decel >> 7) & 0x7F])
23def set_speed(motor, speed):
24 i2c_write([0xD1, motor, speed & 0x7F, (speed >> 7) & 0x7F])
34 0x8B, 0x04, 0x7B, 0x43,
55set_max_acceleration(1, 140)
56set_max_deceleration(1, 300)
59set_max_acceleration(2, 200)
60set_max_deceleration(2, 300)
63set_max_acceleration(3, 80)
64set_max_deceleration(3, 300)
68 if int(time.monotonic() * 1000) & 2048:
78except KeyboardInterrupt: