Class library for a L298 H-Bridge

Revision:
2:5802cf5f739f
Parent:
1:0af00b1a2b52
Child:
3:63766c836789
--- a/L298HBridge.h	Tue Feb 14 12:41:49 2017 +0000
+++ b/L298HBridge.h	Tue Feb 14 13:07:08 2017 +0000
@@ -32,24 +32,28 @@
  * Example:
  * @code
  * #include "mbed.h"
- * #include "HCSR04.h"
+ *#include "L298HBridge.h"
  *
- * HCSR04 distance(PB_8, PA_1);
+ *L298HBridge dcmotor(PA_5, PA_6, PA_10); //Create a L298HBridge object with enable pin on PA5, Fwd pin or PA6 and Rev pin on PA10
  *
- * int main() {
- *     while(1){
- *         SWO.printf("Distance = %d (us)   %f (cm)\n", distance.read_us(), distance.read_cm()); 
- *     }
+ * int main() 
+ * {
+ *    while(1)
+ *    {
+ *          dcmotor.Fwd();               //setting the motor to spin forward
+ *          dcmotor.SetSpeed(0.5);       //setting the speed the motor will spin
+ *    }    
  * }
  * @endcode
  */
  
 class L298HBridge {
   public:
-    /** Create a L298HBridge object connected to the specified pins. Once created, the PWM signal
-    * on the Trig pin will start immediately and measurements will start in the background.
-    * @param ENpin PwmOut compatible pin used to connect to HC-SR04's Trig pin
-    * @param FWDpin InterruptIn compatible pin used to connect to HC-SR04's Echo pin
+    /** Create a L298HBridge object connected to the specified pins. Once created, The pins still need
+    * to be set to a direction and also the speed via PWM.
+    * @param ENpin PwmOut compatible pin used to set the speed of the motor.
+    * @param FWDpin Used to spin the motor in the forward direction.
+    * @param REVDpin Used to spin the motor in the Reverse direction.
     */
     L298HBridge(PinName ENpin, PinName FWDpin, PinName REVpin);
     
@@ -77,7 +81,7 @@
     * @return
     *     None
     */
-    void Speed(float PWMPercentage);
+    void SetSpeed(float PWMPercentage);
  
   private:
     PwmOut _en;