Control a DC motor via a standard H-bridge using a PwmOut pin to control speed and two DigitalOut pins to control direction. Can change pwm period on the PwmOut pin, and also brake high or low.

Dependents:   testmekanik

Fork of Motor by Aaron Berk

Files at this revision

API Documentation at this revision

Comitter:
sarlilouis
Date:
Mon Nov 05 14:27:39 2018 +0000
Parent:
1:c75b234558af
Commit message:
buat jaswin

Changed in this revision

Motor.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c75b234558af -r bfdabfcb2b70 Motor.cpp
--- a/Motor.cpp	Tue Sep 07 11:21:42 2010 +0000
+++ b/Motor.cpp	Mon Nov 05 14:27:39 2018 +0000
@@ -26,7 +26,7 @@
         _pwm(pwm), _fwd(fwd), _rev(rev) {
 
     // Set initial condition of PWM
-    _pwm.period(0.001);
+    _pwm.period(0.002);
     _pwm = 0;
 
     // Initial condition of output enables