Infrared remote library for Arduino: send and receive infrared signals with multiple protocols Port from Arduino-IRremote https://github.com/z3t0/Arduino-IRremote
Dependents: mbed-os-example-FinalReal_copy
Diff: irSend.cpp
- Revision:
- 6:ee990cddff48
- Parent:
- 3:17440cf7ab90
--- a/irSend.cpp Sat Jan 23 15:58:10 2016 +0000 +++ b/irSend.cpp Wed Jan 27 18:07:11 2016 +0000 @@ -1,5 +1,6 @@ #include "IRremote.h" #include "IRremoteInt.h" +#include "cmath" //+============================================================================= void IRsend::sendRaw (unsigned int buf[], unsigned int len, unsigned int hz) @@ -51,7 +52,7 @@ void IRsend::enableIROut (int khz) { _pwm.write(0.0); - _pwm.period_us(1 / khz * 1000); + _pwm.period_us(std::floor((1.0 / khz * 1000) + 0.5)); // round } //+=============================================================================