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: shared/Mbed_MD/Mbed_MD.cpp
- Revision:
- 0:ee7e9405e1c7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shared/Mbed_MD/Mbed_MD.cpp Wed Apr 14 07:26:19 2021 +0000
@@ -0,0 +1,29 @@
+#include <mbed.h>
+#include <shared/Mbed_MD/Mbed_MD.h>
+
+Mbed_MD::Mbed_MD(PinName pwmPin,PinName dirPin): _pwmOut(pwmPin), _dirOut(dirPin)
+{
+ _pwmOut.period(0.00001);
+}
+
+void Mbed_MD::drive(double duty)
+{
+ if(duty >= 0){
+ _pwmOut.write(duty);
+ _dirOut = 0;
+ }else
+ if(duty < 0){
+ _pwmOut.write(-duty);
+ _dirOut = 1;
+ }
+}
+
+void Mbed_MD::brake(double duty)
+{
+}
+
+void Mbed_MD::free()
+{
+ _pwmOut.write(0);
+ _dirOut = 0;
+}
\ No newline at end of file