unit test for brushless motors using a potentiometer and a castle creations esc with 0.5 center duty cycle
Fork of brushlessmotor by
main.cpp
- Committer:
- demaille
- Date:
- 2015-07-29
- Revision:
- 0:187bb46ed128
- Child:
- 2:040b8c8f4f92
File content as of revision 0:187bb46ed128:
#include "mbed.h" #include "Servo.h" #include "esc.h" #include "MainController.h" //ESC esc1(p21); // //Serial pc(USBTX, USBRX); //serial communication via usb cable to display terminal //https://developer.mbed.org/handbook/SerialPC //Timer t; //this is a timer interrupt that is //float throttle_var = 0.5; // // //int main() { // //arm motor by keeping throttle in neutral position // throttle_var = 0.5; // esc1 = throttle_var; // esc1(); // wait_ms (8000); // // // while(1){ // //... update throttle_var ... // throttle_var = 0.15; // esc1 = throttle_var; //memorize the throttle value (it doesn't send it to the ESC). // esc1(); //actually sets the throttle to the ESC. // //20ms is the default period of the ESC pwm; the ESC may not run faster. // wait_ms(3000); // // //flip direction no braking in between // throttle_var = .85; // esc1 = throttle_var; // esc1(); // wait_ms(3000); // // } //} ////////////////////////////////////////////////////////////////////// Serial pc(USBTX, USBRX); //serial communication via usb cable to display terminal //https://developer.mbed.org/handbook/SerialPC Timer t; //this is a timer interrupt that is int main() { t.start(); MainController mainCtrl; mainCtrl.start(); while(true) { pc.printf("frq: %.4f, amp: %.4f, yaw: %.4f, pit: %.4f, dut: %.4f, t: %.4f\n", mainCtrl.getFrequency(), mainCtrl.getAmplitude(), mainCtrl.getYaw(), mainCtrl.getPitch(), mainCtrl.getDutyCycle(), t.read()); wait_ms(900); } //t.stop(); //mainCtrl.stop(); }