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