from machine import Pin,PWM
import time
MG966R1 = PWM(Pin(2, mode=Pin.OUT))
MG966R1.freq(50)
MG966R2 = PWM(Pin(4, mode=Pin.OUT))
MG966R2.freq(50)
# 0.5ms/20ms = 0.025 = 2.5% duty cycle
# 2.4ms/20ms = 0.12 = 12% duty cycle
# 0.025*1024=25.6
# 0.12*1024=122.88
while True:
MG966R1.duty(26)
MG966R2.duty(26)
time.sleep(1)
MG966R1.duty(123)
MG966R2.duty(123)
time.sleep(1)