Tone function does not work with Arduino Due in arduino-1.5.1r2

I have a similar thread to this one in the Programming Questions section of the Forum. I hope it's OK I started one here (I don't know how to move that one over).

I'm fairly certain that the Tone function does not work with the Arduino Due. I get the errors similar to the following each time it's called out when I tried to compile the code:

"toneMelody.ino: In function 'void setup()': toneMelody:36: error: 'tone' was not declared in this scope toneMelody:43: error: 'noTone' was not declared in this scope"

If I change the board to the the Arduino Uno the program compiles fine.

I looked at the Tone.cpp using a text editor. It has if statements for (AVR_ATmega8) or for (AVR_ATmega1280)

not for the Atmel SAM3X8E ARM Cortex-M3 CPU.

I'm thinking code needs to be added to Tone.cpp so that it will work with the Arduino Due.

Does anyone have a fix for this or am I just doing something wrong (I'm very new to this)?

Hi,

Don't bother including Tone.h for the Due (take a look inside it!).

The nearest I've seen so far to getting something going is:

cmaglie: Jim

If you want to build your own, a proof-of-concept sketch for Tone can be found at http://arduino.cc/forum/index.php/topic,136500.msg1029238.html#msg1029238

Thanks for your help.

I appreciate it.

The code works great. Shave and a hair cut. How fun is that.

Thanks again.

Well, you can use the NewToneLib if you need to use tone() on unsupported arduino devices. NewToneLib Github: https://github.com/YordanYordanovGIT/NewToneLib