Custom on off timer

Hi,

I need to output on pin 2 of an Arduino Mega a custom on/off timer. I understand, sort of, how the pwm and timer functions work but i can`t get it to do exactly what i want.

I need to set, for example an on time of 100ms and then an off time of 5 seconds and during this time i have a few other things going on which shouldn`t interupt the on/off timer. Can somebody point me in the right direction please.

Thanks

James

(deleted)