Last active
June 12, 2022 11:36
-
-
Save lean8086/7319725de80bcc135af5a1c883dda6d0 to your computer and use it in GitHub Desktop.
Hello world for servo motors on a Pico with MicroPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from machine import Pin,PWM | |
import utime | |
MID = 1500000 | |
MIN = 1000000 | |
MAX = 2000000 | |
led = Pin(25,Pin.OUT) | |
pwm = PWM(Pin(15)) | |
pwm.freq(50) | |
pwm.duty_ns(MID) | |
while True: | |
pwm.duty_ns(MIN) | |
utime.sleep(1) | |
pwm.duty_ns(MID) | |
utime.sleep(1) | |
pwm.duty_ns(MAX) | |
utime.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment