tone()函数冲突

http://www.geek-workshop.com/thread-4037-1-1.html

可以自制函数newtone()

void newtone(byte tonePin, int frequency, int duration) {
int period = 1000000L / frequency;
int pulse = period / 2;
for (long i = 0; i < duration * 1000L; i += period) {
digitalWrite(tonePin, HIGH);
delayMicroseconds(pulse);
digitalWrite(tonePin, LOW);
delayMicroseconds(pulse);
}
}

后续修改库的方法,后续补上。

相关文章: