Alonso Angulo
/
motordc1
Pot da entrada analogica al KL25Z y salen 2 PWM a las entradas del puente H
motordc1.cpp
- Committer:
- alonsoangulo
- Date:
- 2015-12-01
- Revision:
- 0:d997692fa348
File content as of revision 0:d997692fa348:
#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; } } }