Tone
Tone copied to clipboard
No tone, or "rest"
I am using your library to score music rendered as chords, and I need all three timers on an ATMEGA 328 (Arduino Nano). Problem is, as all timers are occupied, what do I do when I want to rest? I can't seem to use delay() any more.
I use 20000Hz for rests, but I get some clicking artifacts.
Can you add code to deal with perhaps "0" frequency, which would correspond to "no sound", for the specified tone() period? That way I can use the tone() command for sounds and rests.
Thanks for the great library!
Paul
Brute force idea: use a function that effectively does nothing, like changing digital level on an unused pin, time it, and loop that as long as you need to achieve the delay. E.g.:
void bruteDelay(int iterations){ For (int i, i <= iterations, I++){ digitalWrite(unusedPin, !digitalRead(unusedPin)); } } bruteDelay(200); //delays 200 cycles
I am using your library to score music rendered as chords, and I need all three timers on an ATMEGA 328 (Arduino Nano). Problem is, as all timers are occupied, what do I do when I want to rest? I can't seem to use delay() any more.
I use 20000Hz for rests, but I get some clicking artifacts.
Can you add code to deal with perhaps "0" frequency, which would correspond to "no sound", for the specified tone() period? That way I can use the tone() command for sounds and rests.
Thanks for the great library!
Paul
You could use noTone for that I believe.