Fixed motor registers
This commit is contained in:
parent
a2425c7010
commit
bdb7d687bb
1 changed files with 4 additions and 4 deletions
|
@ -34,16 +34,16 @@ class Motor(object):
|
||||||
|
|
||||||
if port == 1:
|
if port == 1:
|
||||||
Spi.write(Register.MOTOR_1_PWM_H, 2, pwm)
|
Spi.write(Register.MOTOR_1_PWM_H, 2, pwm)
|
||||||
Spi.write(Register.MOTOR_1_CTRL, 1, int(mode))
|
Spi.write(Register.PWM_1_CTRL, 1, int(mode))
|
||||||
elif port == 2:
|
elif port == 2:
|
||||||
Spi.write(Register.MOTOR_2_PWM_H, 2, pwm)
|
Spi.write(Register.MOTOR_2_PWM_H, 2, pwm)
|
||||||
Spi.write(Register.MOTOR_2_CTRL, 1, int(mode))
|
Spi.write(Register.PWM_2_CTRL, 1, int(mode))
|
||||||
elif port == 3:
|
elif port == 3:
|
||||||
Spi.write(Register.MOTOR_3_PWM_H, 2, pwm)
|
Spi.write(Register.MOTOR_3_PWM_H, 2, pwm)
|
||||||
Spi.write(Register.MOTOR_3_CTRL, 1, int(mode))
|
Spi.write(Register.PWM_3_CTRL, 1, int(mode))
|
||||||
elif port == 4:
|
elif port == 4:
|
||||||
Spi.write(Register.MOTOR_4_PWM_H, 2, pwm)
|
Spi.write(Register.MOTOR_4_PWM_H, 2, pwm)
|
||||||
Spi.write(Register.MOTOR_4_CTRL, 1, int(mode))
|
Spi.write(Register.PWM_4_CTRL, 1, int(mode))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def power(port: int, percent: float):
|
def power(port: int, percent: float):
|
||||||
|
|
Reference in a new issue