Basically I want to control the angle of the rotation of the servo motor but I don't seem to know how... From the tech sheet I know this motor shouldn't be a continuous one, any hint would be appreciated
I have tried:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.OUT)
p = GPIO.PWM(25, 50)
print("center")
p.start(7.5)
time.sleep(2)
print("45 degree")
p.ChangeDutyCycle(5)
time.sleep(2)
print("The other 45 degree")
p.ChangeDutyCycle(10)
time.sleep(2)
print("Center again")
p.ChangeDutyCycle(7.5)
time.sleep(2)
print("stop")
p.stop()
GPIO.cleanup()
And
from gpiozero import Servo
from time import sleep
myGPIO=25
myCorrection=0.45
maxPW=(2.0+myCorrection)/1000
minPW=(1.0-myCorrection)/1000
servo = Servo(myGPIO,min_pulse_width=minPW,max_pulse_width=maxPW)
while True:
servo.value=0
print("0")
sleep(10)
servo.value=0.6
print("0")
sleep(10)