Servo not working with Rapberry PI 4
I am trying to control Tower Pro MG995 servo with the Raspberry Pi 4B. I am powering the servo with a 5V power supply and when I connect the servo to GPIO 12 or GPIO 18, it doesn't move but when I connect it to GPIO13 or GPIO19, it rotates continuously in one direction. I've tested the servo on an Arduino using the SWEEP example and it works fine there. Is there any problem with my GPIO pins? Please help.
Here's the code that I'm running on the PI
from gpiozero import AngularServo
from time import sleep
a = float(input("Enter Angle "))
servo.angle = a
May I ask where the code came from?
I notice the servo you are using can come with a 360 degree rotation.
I wrote the code myself and now I see that the servo rotates 360 degrees at GPIO 12, 13 and 19 but it has no response at GPIO 18
I would try some other code to see if it acts like a normal servo and what its rotation range is?