-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
This is Issue 1065 moved from a Google Code project.
Added by 2012-10-07T14:50:44.000Z by ElektorEmbedded.
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
What steps will reproduce the problem?
call tone(13,32768,100);
What is the expected output? What do you see instead?
Expected output: a 100 ms burst of a 32768 Hz square wave.
Real output: nothing.
The reason is an overflow in the calculation of toggle_count in the function tone. Overflow occurs for frequencies > 32767 Hz. Line 339:
toggle_count = 2 * frequency * duration / 1000;
should be
toggle_count = 2 * (long)frequency * duration / 1000;
What version of the Arduino software are you using? On what operating
system? Which Arduino board are you using?
Arduino 1.0.1 on Windows 7 and an Arduino Uno board
Regards,
Clemens