Alonso Angulo / Mbed 2 deprecated motordc3

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers motordc3.cpp Source File

motordc3.cpp

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