creating a tone for X amount of time

hello! I'm working on a project with the arduino micro and I need to produce a random hertz for X amount of time on pin 11 then switch to pin 12

unsigned long lastEdge;

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

void loop() {
  unsigned long topLoop = micros();
  if (topLoop - lastEdge > random(1,5000)) {  // 1000000 / (55 * 2)
    digitalWrite(11, !digitalRead(11));
    lastEdge = topLoop;
  }
}

help!

Depending on the frequency you need, you could use Tone(). It is in the reference section of this site. I believe it has provisions for both the desired frequency and duration.

Bill

worked for me thanks!

Glad to help.

Bill