Help with code for robotic toy project please! PIR Motion Sensor to Toy Servo

Trying to make a basic PIR Motion Sensor activate a Servo 45 degrees then -45 degrees repeatedly when input is received. I am a complete beginner. I know that the sensor is digital and the output (servo) is analog.

The basic idea is: If analog sensor = On, then for position of servo +45, move it to -45; for position of servo -45, move it to 45. If analog sensor = Off, then stop the servo.

I need help with the code, I have no experience programming.

Thanks to anyone for help!

Hi,
Start by looking here: http://arduino-info.wikispaces.com/Brick-Pushbuttons%26OtherSwitches And get a simple switch working first. Later hook up your sensor and get it to switch reliably.

Then look here:
Arduino Playground - InterfacingWithHardware And get your servo working +- 45 degrees.

THEN put them together...

DISCLAIMER: I mentioned stuff from my own Shop...