Class library for a L298 H-Bridge to be used for motor control.

Revision:
1:6d242bb216d6
Parent:
0:39561fe6e4ff
Child:
2:1c000b6cf863
diff -r 39561fe6e4ff -r 6d242bb216d6 L298HBridge.cpp
--- a/L298HBridge.cpp	Thu Jan 19 11:33:01 2017 +0000
+++ b/L298HBridge.cpp	Thu Jan 19 12:34:48 2017 +0000
@@ -6,20 +6,25 @@
     _ENPin = 0;     //PWM = 0%
     _FWDPin = 0;
     _REVPin = 0;
+    _ENPin.period(0.020); //set PWM period to 20mS as default.
 }
  
-void L298HBridge::Fwd() {
-
+void L298HBridge::Fwd() {    
+    _FWDPin = 1;
+    _REVPin = 0;
 }
 
 void L298HBridge::Rev() {
-
+    _FWDPin = 0;
+    _REVPin = 1;
 }
 
 void L298HBridge::Stop() {
-
+    _FWDPin = 0;
+    _REVPin = 0;
 }
  
 void L298HBridge::Speed(int DutyPercent) {
-
+    //_ENPin=(float)(DutyPercent/100);
+    _ENPin = DutyPercent;
 }
\ No newline at end of file