Nick Restivo / PwmIn

Dependents:   ParamotorControl

Files at this revision

API Documentation at this revision

Comitter:
bignick26
Date:
Thu Dec 13 21:28:56 2018 +0000
Parent:
1:6d68eb9b6bbb
Commit message:
Changed the definition of how to receive a PWM input such that when no signal is received, the output of the function dutycycle() is 0.0, instead of holding the last value received.

Changed in this revision

PwmIn.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6d68eb9b6bbb -r 65fd472f6314 PwmIn.cpp
--- a/PwmIn.cpp	Thu Sep 02 18:17:35 2010 +0000
+++ b/PwmIn.cpp	Thu Dec 13 21:28:56 2018 +0000
@@ -39,6 +39,10 @@
 }
 
 float PwmIn::dutycycle() {
+    if (_t.read() > 1.0) {
+        //detach iterrupt?
+        return 0;
+    }
     return _pulsewidth / _period;
 }