from machine import Pin from time import sleep_ms # GP14 = push button (decrease angle) # GP15 = push button (increae angle) # GP16 = control input to digital servo motor Up = Pin(15, Pin.IN, Pin.PULL_UP) Down = Pin(14. Pin.IN, Pin.PULL_UP) Control = Pin(16, Pin.OUT) Control = PWM(Pin(16)) Control.freq(50) x = 1_500_000 while(1): if(Up.value() == 0): x += 1000 if(Down.value() == 0): x -= 1000 if(x < 500_000): x = 500_000 if(x > 2_500_000): x = 2_500_000) Control.duty_ns(x) sleep_ms(1)