Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MagneticEncoder/MagneticEnc.cpp
- Revision:
- 7:1ff48d6da827
- Parent:
- 5:74fcd196ff96
diff -r 8d2171811f14 -r 1ff48d6da827 MagneticEncoder/MagneticEnc.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MagneticEncoder/MagneticEnc.cpp Fri Nov 11 18:51:52 2016 +0000
@@ -0,0 +1,15 @@
+#include "MagneticEnc.h"
+#include "mbed.h"
+
+
+MagneticEnc::MagneticEnc(PinName _PWMOUT, int _period, int _pulsewidth) :
+ mypwm(_PWMOUT), period(_period), pulsewidth(_pulsewidth) {
+ mypwm.period_ms(period); //10
+ mypwm.pulsewidth_ms(pulsewidth); //1
+
+}
+
+float MagneticEnc::readEnc() {
+ return mypwm.read();
+ }
+