IR Proximity Sensor with counter..? mArhsgdjhag!

I am a final year art student - finishing my degree in a matter of days.. just wondering if anyone could point me in the direction of some code that will persuade my IR sensor to turn off a motor when triggered, and back on again when out of range.. then once has been triggered 1000 times to freak out a bit (turn on and off and on again), then again every 500 triggers..

:-/ Any ideas? x

what ir sensor. what motor. and how is it all connected

Try looking into switch / case statements: http://arduino.cc/en/Reference/SwitchCase. You can set up a variable to count up by 1 every time the IR sensor triggers, and when it gets to 1000, the switch case will invoke the "freak out" code.