Coding a pulse signal

Hi, I’m working on a project where I need to send a 41 kHz signal every x ms. I’ve already written the code that generates the 41 kHz signal thanks to the timers but I don’t know how to code to send a pulse of the signal every x time. Here is my code:

void generation1()
{
  TCCR2A = _BV(COM2A0) | _BV(WGM21) | _BV(WGM20);
  TCCR2B = _BV(WGM22) | _BV(CS20);
  OCR2A = B11000001;
}

void setup()
{
  pinMode(11, OUTPUT);
}

void loop()
{ 
    generation1();
}

For example, if I want to send the this signal for 1s then stop it for 1s then starting over again, what should I code? Thanks for your answers and sorry for my english.

Gueryska

Search for MrTimer or TimerOne library.