Most of the following articles are as they are. Although it is mentioned in the article, I feel that incorrect information is scattered, so I will post it here in the sense that it worked.
http://bufferoverruns.blogspot.jp/2016/08/raspberry-pisg-90.html
Originally I used a library called ServoBlaster as below, but due to the influence of the Linux kernel change, it became completely unresponsive and I was looking for an alternative (neither jessie nor stretch worked).
http://qiita.com/lumbermill/items/218944f816bdb0483e3c
So the program is as follows.
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
gp_out = 4
GPIO.setup(gp_out, GPIO.OUT)
servo = GPIO.PWM(gp_out, 50)
servo.start(0.0)
for i in range(10):
servo.ChangeDutyCycle(2.5)
time.sleep(0.5)
servo.ChangeDutyCycle(12.0)
time.sleep(0.5)
GPIO.cleanup()
Reference: Servo control with Arduino
Recommended Posts