unit test for brushless motors using a potentiometer and a castle creations esc with 0.5 center duty cycle

Dependencies:   ESC Servo mbed

Fork of brushlessmotor by jetfishteam

main.cpp

Committer:
rkk
Date:
2016-02-26
Revision:
3:605f216167f6
Parent:
2:040b8c8f4f92

File content as of revision 3:605f216167f6:

#include "mbed.h"
#include "Servo.h"
#include "esc.h"
#include "MainController.h"

//ESC esc1(p25);
//
//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 mC;
       
    mC.start();

    while(true) {
  
        pc.printf("amp: %.4f, dutyCycle %.4f, t: %.4f\n",
         mC.getAmplitude(), mC.getDutyCycle(), t.read());

        wait_ms(900);
    }
    //t.stop();
    //mC.stop();
}