Pages: [1]   Go Down
Author Topic: Tone function does not work with Arduino Due in arduino-1.5.1r2  (Read 1824 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Brighton, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Jr. Member
**
Karma: 9
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your help.

I appreciate it.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks again.
Logged

Pages: [1]   Go Up
Jump to: