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 00007 TraccionD M1(PC_14, PE_6, PE_4, PE_2, 200, 3.3, 7.5); 00008 00009 00010 00011 DigitalOut LED(PD_14); 00012 00013 int main() { 00014 00015 long SOH1; 00016 00017 00018 PC.printf("Hello World...\n"); 00019 M1.StepFreq(20); 00020 M1.Giro(270, true); 00021 00022 //M1.Run(2.5); 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 wait(0.3); 00033 M1.StepFreq(20); 00034 M1.Giro(270, false); 00035 //M1.Run(2.5); 00036 00037 while(1) 00038 { 00039 SOH1 = M1.getStepOnHold(); 00040 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00041 if(SOH1 < 10){ M1.StopT(); break; } 00042 wait(0.3); 00043 } 00044 00045 00046 00047 long cont; 00048 while(1) { 00049 00050 PC.printf("run %d...\n", cont++); 00051 00052 //////// Giro sentido 1 00053 LED = 1; 00054 wait(2); 00055 00056 SOH1 = M1.getStepOnHold(); 00057 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00058 00059 wait(0.5); 00060 00061 //////// Giro sentido contrario 00062 LED = 0; 00063 wait(2); 00064 00065 SOH1 = M1.getStepOnHold(); 00066 PC.printf("StepOnHold M1 = %d ;\n" , SOH1); 00067 00068 wait(0.5); 00069 00070 } 00071 }
Generated on Tue Feb 13 2024 23:41:13 by
1.7.2