You need to research your servo and see what its specs are. According to that code it calls pin 4 for the servo pin which unless im looking at it wrong is a ground... Lemme see if i can look up some things to help.

What servo are you using?