Control an H-Bridge using a PwmOut (enable) and two DigitalOuts (direction select)

Fork of Motor by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
miczyg
Date:
Thu May 07 11:05:06 2015 +0000
Parent:
4:5370aae8ee3b
Child:
6:a321d28cce9a
Commit message:
gotowiec prawie

Changed in this revision

Motor.cpp Show annotated file Show diff for this revision Revisions of this file
Motor.h Show annotated file Show diff for this revision Revisions of this file
--- a/Motor.cpp	Thu May 07 09:47:58 2015 +0000
+++ b/Motor.cpp	Thu May 07 11:05:06 2015 +0000
@@ -23,8 +23,6 @@
 #include "Motor.h"
 #include "mbed.h"
 
-#define AUTO 1
-
 Motor::Motor(PinName pwm, PinName fwd, PinName rev) :
 _pwm(pwm), _fwd(fwd), _rev(rev), speedControl(K, Ti, Td, itv), encoder(CH_A, CH_B, NC, pPerRev)
 {
@@ -63,6 +61,3 @@
     _rev = (speed < 0.0);
     _pwm = abs(speed);
 }
-
-
-
--- a/Motor.h	Thu May 07 09:47:58 2015 +0000
+++ b/Motor.h	Thu May 07 11:05:06 2015 +0000
@@ -32,12 +32,13 @@
 const float Ti = 0;
 const float Td = 0;
 const float itv = 0.001;
+#define AUTO 1
 
 /*QEI pins*/
 #define CH_A PTA2
 #define CH_B PTA3
 const int pPerRev = 10;
-const int max_pulse_rate; //do policzenia!!!!!!!!!!!!!!!!!!!
+const int max_pulse_rate = 300; //do policzenia!!!!!!!!!!!!!!!!!!!
 
 /** Interface to control a standard DC motor
 *