jdecked / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

tone() fails under 31Hz #558

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call tone(13,31). You will see a very fast blinking on the LED.
2. Call tone(13,30). You will see a seemingly continuously lit LED (it actually 
is a very high frequency blink).
Any frequency below 31Hz will reproduce the problem.

What is the expected output? What do you see instead?
Expect to see the correct frequency, but a much higher one is seen instead 
(using an oscilloscope). Also observed on other digital pins.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?
Tried on Arduino UNO and Nano with ATMega328,
using Arduino 0022 on linux.

Original issue reported on code.google.com by adrianra...@gmail.com on 10 Jun 2011 at 2:31

GoogleCodeExporter commented 9 years ago
In particular, tone(13, 0) does not work! It makes driving stepper motors 
unnecessarily complicated since you have to use:

if (desiredSpeed == 0)
   noTone(PIN_PULSE);
else
   tone(PIN_PULSE, desiredSpeed);

Which is kind of stupid.

AT THE VERY LEAST THE USELESS DOCUMENTATION SHOULD SAY THIS!!

Original comment by tdh...@gmail.com on 13 Nov 2013 at 10:05