Hi, Thanks before hand, for your help...
For my second project with arduino, I´m trying to emulate a multi tone siren with flashing leds, specifically this one Kingvox Siren I managed the simple tones like the high-low, low-high using "Tones.h" up to like the 8th or 9th melody on the video, even some dual tones generating a for loop with the wanted frequency on one pin and offsetting the same by 100hz the second pin and and mixing them with 1K resistors... like so...
#include <Tone.h>
Tone Tone1;
Tone Tone2;
//SIREN 1 --> TRIANGLE
void Siren1(int count, int dl)
{
while (count --)
{
int i;
for (i = 587; i <= 1397; i++) {
Tone1.play(i);
delay(dl);
}
for (i = 1397; i >= 587; i--) {
Tone1.play(i);
delay(dl);
}
}
}
// SIREN 2 --> DUAL TRIANGLE
void Siren2(int count, int dl)
{
while (count --)
{
int i;
for (i = 587; i <= 1397; i++) {
Tone1.play(i);
Tone2.play(i - 100);
delay(dl);
}
for (i = 1397; i >= 587; i--) {
Tone1.play(i);
Tone2.play(i - 100);
delay(dl);
}
}
}
void setup()
{
Tone1.begin(7);
Tone2.begin( 8 );
Siren1(7, .2);
Siren2(7, .2);
Tone2.stop();
Siren1(1, 3);
Siren2(1, 3);
Tone2.stop();
Tone1.stop();
Tone2.stop();
}
void loop() {
}
Now this works fine for me, in Siren2, Pin7 plays Tone1 and Pin8 plays Tone2 what seem simultaneously, but I ran into trouble and I can´t simulate this...
I figure it´s the same as above code but different count and delays....I just dón´t have enough coding experience to put them together in one loop or two but running concurrent on pin7 & pin8
any help would be greatly apreciated...