2 tone's?

Hi. Is there a way I can have 2 tones going at once? I was reading the reference, and it said I couldn’t, but I would like to make sure.

Use the Tone Library (instead of the tone function)...
http://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation

I mean't 2 tones on different pins, if that were to help. :slight_smile:

Whoops, to late.

That’s sort of confusing. I like using tone() because it’s easy and I know how to use it. I’ll try and figure something out. But if I get stuck, how would I convert these lines of code into usable code for the tone library:

for (int pitch=247;pitch<988;pitch++){
    tone(9,pitch/2,10);
tone(9,pitch,10);
  delay(5);
}

Tone tone1;

void setup(void)
{
tone1.begin( 9 );
}

void loop( void )
{
for (int pitch=247;pitch<988;pitch++)
{
tone1.play( pitch/2, 10 );
tone1.play( pitch, 10 );
delay(5);
}
}

That’s what I thought.

Would this work for 2 speakers on different pins:

Tone tone1;
Tone tone2;

void setup(void)
{
tone1.begin( 9 );
tone2.begin( 10 );
}

void loop( void )
{
for (int pitch=247;pitch<988;pitch++)
{
tone1.play( pitch/2, 10 );
tone2.play( pitch, 10 );
delay(5);
}
}

Yes.

Warning: Each running tone uses one timer. Two simultaneous tones = two timers in use.