Hello,
I have a for loop in a function:
def off_on():
pos = 0
for (pos == 0, pos <= 180, pos += 1):
pwm_controller.set_pwm_frequency(66)
pwm_controller.set_servo_angle(15, pos)
sleep(2)
for (pos == 180, pos >= 0, pos -= 1):
pwm_controller.set_pwm_frequency(66)
pwm_controller.set_servo_angle(15, pos)
sleep(2)
In the for
loop, I have tried alterations of the source so far. I have tried to handle it this way:
def off_on():
pos = 0
for (pos = 0, pos <= 180, pos += 1):
pwm_controller.set_pwm_frequency(66)
pwm_controller.set_servo_angle(15, pos)
sleep(2)
for (pos = 180, pos >= 0, pos -= 1):
pwm_controller.set_pwm_frequency(66)
pwm_controller.set_servo_angle(15, pos)
sleep(2)
Neither are seemingly working. In my function called off_on
, I cannot seem to find the correct way Python3 handles the -=
or +=
association to the variable in the for loop.
Seth
P.S. If anyone sees my error, please let me know.