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

Fork of Motor by Simon Ford

Revision:
7:d25073d59616
Parent:
6:a321d28cce9a
Child:
8:d192b38e0d5c
--- a/Motor.cpp	Sat May 09 11:04:49 2015 +0000
+++ b/Motor.cpp	Wed May 13 16:25:05 2015 +0000
@@ -23,14 +23,14 @@
 #include "Motor.h"
 #include "mbed.h"
 
-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)
+Motor::Motor(PinName pwm, PinName fwd, PinName rev, PinName stby) :
+_pwm(pwm), _fwd(fwd), _rev(rev), _stdby(stby), speedControl(K, Ti, Td, itv)//, encoder(CH_A, CH_B, NC, pPerRev)
 {
 
     // Set initial condition of PWM
     _pwm.period(0.001);
     _pwm = 0;
-
+    _stdby = 1;
     // Initial condition of output enables
     _fwd = 0;
     _rev = 0;
@@ -43,6 +43,8 @@
 }
 
 void Motor::speed(float speed) {
+
+/*PID do enkoderow i utrzymywania stalej predkosci*/
 /*
     if (speed != set_speed){
         speedControl.setSetPoint(speed);