glynd:
This like a great library and is perfect for my needs, if only it worked...On ATmega1284p (Dip)
The following code should make 10 tones, each with increasing volume, and a 0.2 second delay between each tone.
for (byte volume=1; volume<=10; volume++) {
toneAC (2000, volume, 500, false);
delay (200);
}
However, the volume isn't changing. The first 8 tones are identical, and then the last two tones (where volume is set to 9 and 10), it changes to a much higher frequency, but no change in volume. Using ToneAC, V1.4
glynd:
This like a great library and is perfect for my needs, if only it worked...On ATmega1284p (Dip)
The following code should make 10 tones, each with increasing volume, and a 0.2 second delay between each tone.
for (byte volume=1; volume<=10; volume++) {
toneAC (2000, volume, 500, false);
delay (200);
}
However, the volume isn't changing. The first 8 tones are identical, and then the last two tones (where volume is set to 9 and 10), it changes to a much higher frequency, but no change in volume. Using ToneAC, V1.4
Well, it does work for me. I don't have a ATmega1284p so that could be the problem. For the ATmega328 it works without a hitch.
Also, the volume isn't the real feature of this library. It's a bonus and is not at all perfect.
The real purpose of the library is for higher volume and higher frequency. I would suggest only ever using the default volume (full) as lower volumes really just change the duty cycle which isn't so effective. It does work (at least on a 328) but it's not at all what the library is primarily designed to do.
If you're looking for a library to output different volume, look elsewhere. If you want a library to produce higher sound output and can handle higher frequencies, then this is the library for you.
For fun, try changing the frequency in your sketch to 1000 or 5000 and see if the results are different.
Tim