Files
mixly3/boards/default/micropython_nrf51822_microbit/build/lib/Servo.py
2024-07-19 10:16:00 +08:00

6 lines
157 B
Python

from microbit import *
def angle(pin, angle):
pin.set_analog_period(round((1/50) * 1000))
duty = 26 + (angle * 102) / 180
pin.write_analog(duty)