Search code examples
carduino

How do I implement tone() and noTone() for the Arduino Due?


As it turns out, noTone() and tone() are in the core arduino API, but seemingly not implemented for the Arduino Due. I was hoping to use tone() and noTone() to implement the mario death sound found here, but when I add the code and compile it, I get the following errors:

trenchRun:154: error: 'tone' was not declared in this scope
trenchRun:156: error: 'noTone' was not declared in this scope

In case you're interested, here's an SSCCE, compiled against Arduino 1.5.4 on Mac OS X 10.8:

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  tone(1, 12345, 1000);
}
sketch_oct24a.ino: In function 'void loop()':
sketch_oct24a:7: error: 'tone' was not declared in this scope

Since I have an Arduino Due, I am limited in using Arduino 1.5.4.

How do I implement the tone() and noTone() functions for the Due?


Solution

  • Yes it seems that it is still disabled in the current version.

    A quick search on the Arduino forum got me this : Arduino Due and tone() I can't test their code but it seems that the guy found a pretty decent solution to make his own tone().

    Have a look and tell us if it's working good.

    Hope it helps! :)