tone() 和 IRremote 冲突的解决办法

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);
}
}

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

转载于:https://www.cnblogs.com/pengwenzheng/p/8353625.html

你可能感兴趣的:(tone() 和 IRremote 冲突的解决办法)