Go Down

Topic: Tone function does not work with Arduino Due in arduino-1.5.1r2 (Read 2178 times) previous topic - next topic

Zendue

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)?


jgmdavies

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:



Jim

mantoui

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


Zendue

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

Thanks again.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy