[solved]minimal tone() frequency ?

hello everybody

I was trying to get a LED blinking without using most of the computing time with some delay(), and when reading the tone() documentation, I did'nt find there is a lower limit to the frequency it can generate. Just in one of the exemples, minimal frequency is set to 10Hz, but as the goal here is to produce a sound, that looks normal.

So I said to myself ok, this will do the trick.

Some experiments later, deception... under about 100Hz, the frequency I get is different from the one asked, for exemple here is what I get for a frequency set to 10Hz :

void setup(){
void loop(){

something with a period of 0,513ms, that means... 1,9kHz. Oops.

And where I really don't understand anything, it's when I ask for a 1Hz frequency, this is what I get :

And that really looks like a 1Hz square wave (well, 0,92Hz, but not so bad) ! Ok, very good... but wait, the LED connected to the pin delivering this signal keep lighting, not blinking at all...

In fact, when I change the oscilloscope time base, this is what I get :

Somewhat a square wave, but with some small stairs during the high an low fronts, forming like a triangle modulation. According to the oscilloscope, this signal is about 60Hz.

And when I reduce more the time base, I get this :

A nice 60Hz square. If I reduce more the time base, it keeps showing this 60Hz square. So its normal I don't see the led blinking, 60Hz is a too high frequency.

I quite puzzled with the fact oscilloscope shows first a 1Hz square, but I suppose this is somawhat related to interference between it's sampling frequency and the small ticks that looks like making a triangle modulation.

I made these test with a Uno R2 and a Nano V3, result is the same.

The oscilloscope is a DSO quad DS203.

Arduino IDE is 1.0, on Ubuntu linux 12.04.

I don't know if this is a bug of the tone() function, but obviously something is not going well.

Does this help... http://arduino.cc/forum/index.php/topic,48727.msg348565.html#msg348565

yeah, thank you very much ! This is exactly the answer :) I think some modification of the tone doc is needed to include the fact the frequency range is 31Hz - 65.5kHz with the built-in tone() function.

If we need a wider frequency range, starting from 1Hz, we must use the Tone library from the following link : http://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation