Pot da entrada analogica al KL25Z y salen 2 PWM a las entradas del puente H

Dependencies:   mbed

Revision:
0:d997692fa348
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/motordc1.cpp	Tue Dec 01 04:09:19 2015 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+AnalogIn pot(PTB3);
+PwmOut IN1(PTD4);
+PwmOut IN2(PTA12);
+DigitalIn boton1(PTB2);
+DigitalIn boton2(PTB1);
+DigitalOut myled(LED1);
+
+int main() {
+        myled = 0;
+        wait(0.5);
+        myled = 1;
+        
+    while(1) {
+        if (boton1==0 && boton2==1){
+            float input = pot; 
+            IN1 = input; 
+            IN2 = 0;
+            wait(0.1); 
+        } else if(boton1==1 && boton2==0){
+            float input = pot; 
+            IN2 = input; 
+            IN1 = 0;
+            wait(0.1); 
+        } else if(boton1==1 && boton2==1){
+             IN1=0;
+             IN2=0;
+        } else if(boton1==0 && boton2==0){
+             IN1=0;
+             IN2=0;
+             }
+        
+        
+    }
+}