PWM with L298 for two DC Motors.

Dependencies:   mbed FPointer TextLCD1 keypad

Fork of L298 by Juan Carlos Suárez Barón

Revision:
0:f3cd2e9ab89b
Child:
1:c83539e7f8a0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 20 05:18:43 2016 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+DigitalOut in1(PTC3);
+DigitalOut in2(PTC2);
+PwmOut     ena(PTA2);
+
+int main()
+{
+    while (true) {
+        // Detiene el motor
+        in1 = 0; 
+        in2 = 0;
+        wait(0.5f);
+        // Gira en sentido 1 con velocidad 50%
+        in1 = 1;
+        in2 = 0;
+        ena.write(0.50f);
+        wait(0.5f);
+        // Gira en sentido 2 con velocidad 100%
+        in1 = 0;
+        in2 = 1;
+        ena.write(1.00f);
+        wait(0.5f);
+    }
+}
\ No newline at end of file