如何实现Arduino Due的tone()和noTone()?

Geo*_*ker -5 c arduino

事实证明,noTone()tone()在核心的arduino API中,但似乎没有Arduino Due实现。我希望使用tone()noTone()实现此处找到的马里奥死亡声音,但是当我添加代码并对其进行编译时,出现以下错误:

trenchRun:154: error: 'tone' was not declared in this scope
trenchRun:156: error: 'noTone' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

如果您有兴趣,这里有一个SSCCE,是在Mac OS X 10.8上针对Arduino 1.5.4编译的:

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

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

由于我有Arduino Due,因此我只能使用Arduino 1.5.4。

如何实现Due 的tone()noTone()功能?

lad*_*las 5

是的,它似乎在当前版本中仍处于禁用状态。

在Arduino论坛上的快速搜索使我明白了这一点:Arduino Due和tone() 我无法测试他们的代码,但看来这家伙找到了一个不错的解决方案来制作自己的代码tone()

看看并告诉我们是否运作良好。

希望能帮助到你!:)