Last active
January 30, 2023 21:01
-
-
Save gigafide/9d50d70013badcccb651b7fed95c4538 to your computer and use it in GitHub Desktop.
Simple Raspberry Pi Pico Servo Sweep
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 time | |
servo = PWM(Pin(0)) | |
servo.freq(50) | |
while True: | |
for position in range(1000, 9000, 50): | |
servo.duty_u16(position) | |
time.sleep(0.1) | |
for position in range(9000, 1000, -50): | |
servo.duty_u16(position) | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment