Alonso Angulo / Mbed 2 deprecated motordc1

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers motordc1.cpp Source File

motordc1.cpp

00001 #include "mbed.h"
00002 
00003 AnalogIn pot(PTB3);
00004 PwmOut IN1(PTD4);
00005 PwmOut IN2(PTA12);
00006 DigitalIn boton1(PTB2);
00007 DigitalIn boton2(PTB1);
00008 DigitalOut myled(LED1);
00009 
00010 int main() {
00011         myled = 0;
00012         wait(0.5);
00013         myled = 1;
00014         
00015     while(1) {
00016         if (boton1==0 && boton2==1){
00017             float input = pot; 
00018             IN1 = input; 
00019             IN2 = 0;
00020             wait(0.1); 
00021         } else if(boton1==1 && boton2==0){
00022             float input = pot; 
00023             IN2 = input; 
00024             IN1 = 0;
00025             wait(0.1); 
00026         } else if(boton1==1 && boton2==1){
00027              IN1=0;
00028              IN2=0;
00029         } else if(boton1==0 && boton2==0){
00030              IN1=0;
00031              IN2=0;
00032              }
00033         
00034         
00035     }
00036 }