Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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 }
Generated on Wed Jul 27 2022 10:07:33 by
1.7.2