motor test 17
This commit is contained in:
1 parent
18fe7a6d81
commit
097c172339
1 file changed
+32
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
servoPIN = 17
|
||||
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(servoPIN, GPIO.OUT)
|
||||
|
||||
p = GPIO.PWM(servoPIN, 50) # GPIO 17 als PWM mit 50Hz
|
||||
p.start(2.5) # Initialisierung
|
||||
try:
|
||||
while True:
|
||||
p.ChangeDutyCycle(5)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(7.5)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(10)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(12.5)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(10)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(7.5)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(5)
|
||||
time.sleep(0.5)
|
||||
p.ChangeDutyCycle(2.5)
|
||||
time.sleep(0.5)
|
||||
except KeyboardInterrupt:
|
||||
p.stop()
|
||||
GPIO.cleanup()
|
||||
Reference in new issue
Block a user