If you connect your battery/servo and pi like this
if you are unsure of your servo connection colour coding have a look here
it covers most of the common servo wiring colour codes ( scroll to bottom of page for colour codes ).
and then run this code
Code: Select all
import RPi.GPIO as GPIO
p = GPIO.PWM(23, 50)
your servo should move from one end of it travel to the other repeatedly, until you Crtl , C