Some remarks on your code in initial post
- line 3: IndentationError: unexpected indent
there is a blank before the code
- line 38: AttributeError: 'PWM' object has no attribute 'value'
there is a happy mix between PWM code and GPIO code.
pwm uses duty_u16(some_value_between_0_and_65535)
gpio uses value(zero_or_one)
To be consistent, do not use (replace all similar places)
motor_left_forward.value(0)
but
turn_motor_off(motor_left_forward)
The method name "turn_motor_off", "turn_motor_on" are misleading. These methods just control half of a H-Bridge of a motor; to really have a motor be stopped or running both of the H-Bridge inputs need to be set.
- line 3: IndentationError: unexpected indent
there is a blank before the code
- line 38: AttributeError: 'PWM' object has no attribute 'value'
there is a happy mix between PWM code and GPIO code.
pwm uses duty_u16(some_value_between_0_and_65535)
gpio uses value(zero_or_one)
To be consistent, do not use (replace all similar places)
motor_left_forward.value(0)
but
turn_motor_off(motor_left_forward)
The method name "turn_motor_off", "turn_motor_on" are misleading. These methods just control half of a H-Bridge of a motor; to really have a motor be stopped or running both of the H-Bridge inputs need to be set.
Statistics: Posted by ghp — Fri Oct 18, 2024 5:30 am