Then I used their codes, all of them, but none could work.
I confirm that my raspberry pi can work and the connections of lines are correct. And my servo is new so it should work .
Here is my code (It's based on python3):
Code: Select all
#! python3
import RPi.GPIO as GPIO
import time
tilt = 12
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(tiltPin, GPIO.OUT)
tilt = GPIO.PWM(tiltPin, 50)
tilt.start(0)
tilt.ChangeDutyCycle(2)
time.sleep(1)
tilt.ChangeDutyCycle(3)
time.sleep(1)
tilt.stop()
GPIO.cleanup()