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.
Fork of brushlessmotor by
main.cpp
00001 #include "mbed.h" 00002 #include "Servo.h" 00003 #include "esc.h" 00004 #include "MainController.h" 00005 00006 //ESC esc1(p25); 00007 // 00008 //Serial pc(USBTX, USBRX); //serial communication via usb cable to display terminal //https://developer.mbed.org/handbook/SerialPC 00009 //Timer t; //this is a timer interrupt that is 00010 //float throttle_var = 0.5; 00011 // 00012 // 00013 //int main() { 00014 // //arm motor by keeping throttle in neutral position 00015 // throttle_var = 0.5; 00016 // esc1 = throttle_var; 00017 // esc1(); 00018 // wait_ms (8000); 00019 // 00020 // 00021 // while(1){ 00022 // //... update throttle_var ... 00023 // throttle_var = 0.15; 00024 // esc1 = throttle_var; //memorize the throttle value (it doesn't send it to the ESC). 00025 // esc1(); //actually sets the throttle to the ESC. 00026 // //20ms is the default period of the ESC pwm; the ESC may not run faster. 00027 // wait_ms(3000); 00028 // 00029 // //flip direction no braking in between 00030 // throttle_var = .85; 00031 // esc1 = throttle_var; 00032 // esc1(); 00033 // wait_ms(3000); 00034 // 00035 // } 00036 //} 00037 00038 ////////////////////////////////////////////////////////////////////// 00039 00040 00041 Serial pc(USBTX, USBRX); //serial communication via usb cable to display terminal //https://developer.mbed.org/handbook/SerialPC 00042 Timer t; //this is a timer interrupt that is 00043 00044 int main() 00045 { 00046 t.start(); 00047 00048 MainController mC; 00049 00050 mC.start(); 00051 00052 while(true) { 00053 00054 pc.printf("amp: %.4f, dutyCycle %.4f, t: %.4f\n", 00055 mC.getAmplitude(), mC.getDutyCycle(), t.read()); 00056 00057 wait_ms(900); 00058 } 00059 //t.stop(); 00060 //mC.stop(); 00061 }
Generated on Tue Jul 12 2022 21:22:42 by
 1.7.2
 1.7.2 
    