-
1Step 1
Python Code:
import RPi.GPIO as GPIO
import time
servoPIN = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN, GPIO.OUT)
p = GPIO.PWM(servoPIN, 50) # GPIO 18 als PWM mit 50Hz
p.start(2.5) # Initialisierung
i = 0
try:
while True:
p.ChangeDutyCycle(5)
time.sleep(0.1)
p.ChangeDutyCycle(2.5)
time.sleep(0.1)
if i == 20:
break
i = i + 1
p.stop()
GPIO.cleanup()
except KeyboardInterrupt:
p.stop()
GPIO.cleanup()
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.