from machine import Pin, PWM
from time import sleep
servo_1 = PWM(Pin(2, mode=Pin.OUT))
servo_1.freq(50)
servo_2 = PWM(Pin(4, mode=Pin.OUT))
servo_2.freq(50)
servo_3 = PWM(Pin(5, mode=Pin.OUT))
servo_3.freq(50)
buttom_1 = Pin(21, Pin.IN, Pin.PULL_UP)
buttom_2 = Pin(22, Pin.IN, Pin.PULL_UP)
buttom_3 = Pin(23, Pin.IN, Pin.PULL_UP)
while True:
if buttom_1.value() == 0:
servo.duty(26)
sleep(1)
else:
servo.duty(123)
sleep(1)
if buttom_2.value() == 0:
servo_2.duty(26)
sleep(1)
else:
servo_2.duty(123)
sleep(1)
if buttom_3.value() == 0:
servo_3.duty(26)
sleep(1)
else:
servo_3.duty(123)
sleep(1)