Joshua Marshall / IRremote

Files at this revision

API Documentation at this revision

Comitter:
yuhki50
Date:
Wed Jan 27 18:07:11 2016 +0000
Parent:
5:a4dfe2bb80b9
Child:
7:c82a0d54a024
Commit message:
fix enableIROut method

Changed in this revision

irSend.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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
 }
 
 //+=============================================================================