Skip to content

Instantly share code, notes, and snippets.

@Bill-Park
Created January 10, 2020 02:40
Show Gist options
  • Save Bill-Park/21ddd6052ff3bc109d044d117950692b to your computer and use it in GitHub Desktop.
Save Bill-Park/21ddd6052ff3bc109d044d117950692b to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
servoPin = 18
GPIO.setup(servoPin, GPIO.OUT)
p = GPIO.PWM(servoPin, 50) # set to 50Hz
p.start(0)
p.ChangeDutyCycle(3)
sleep(1)
p.ChangeDutyCycle(7.5)
sleep(1)
p.ChangeDutyCycle(12)
sleep(1)
p.stop()
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment