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.
main.cpp
00001 #include "mbed.h" 00002 #include "Motor.h" 00003 00004 Serial PC(PA_2, PA_3); 00005 00006 MotorContinuo Mizq(PD_13, PD_11, PB_15, NC,NC,0); 00007 MotorContinuo motorprueba(PA_0, PA_1,PA_3); 00008 MotorDiscreto M1(PC_14, PE_6, 200, NC, NC, 0); 00009 00010 00011 00012 DigitalOut LED(PD_14); 00013 00014 int main() { 00015 00016 long SOH1; 00017 00018 00019 PC.printf("Hello World...\n"); 00020 M1.Forward(); 00021 M1.StepFreq(300); 00022 M1.RunRound(1); 00023 00024 while(1) 00025 { 00026 SOH1 = M1.getStepOnHold(); 00027 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00028 if(SOH1 < 10){ M1.StopT(); break; } 00029 wait(0.3); 00030 } 00031 00032 M1.Back(); 00033 M1.StepFreq(350); 00034 M1.RunRound(1); 00035 00036 while(1) 00037 { 00038 SOH1 = M1.getStepOnHold(); 00039 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00040 if(SOH1 < 10){ M1.StopT(); break; } 00041 wait(0.3); 00042 } 00043 00044 00045 00046 long cont; 00047 while(1) { 00048 00049 PC.printf("run %d...\n", cont++); 00050 00051 //////// Giro sentido 1 00052 LED = 1; 00053 Mizq.Forward(); 00054 Mizq.SpeedDuty(100); 00055 wait(2); 00056 00057 SOH1 = M1.getStepOnHold(); 00058 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00059 00060 Mizq.Stop(); 00061 wait(0.5); 00062 00063 //////// Giro sentido contrario 00064 LED = 0; 00065 Mizq.Back(); 00066 Mizq.SpeedDuty(100); 00067 wait(2); 00068 00069 SOH1 = M1.getStepOnHold(); 00070 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00071 00072 Mizq.StopT(); 00073 wait(0.5); 00074 00075 } 00076 }
Generated on Sun Jul 17 2022 04:27:37 by
1.7.2