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

MainController.h

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

File content as of revision 3:605f216167f6:

#ifndef MBED_MAINCONTROLLER_H
#define MBED_MAINCONTROLLER_H
 
#include "mbed.h"
#include "esc.h"

#define MATH_PI 3.14159265359
#define TOFF 0.03
class MainController {
public:
    /** Create a MainController
     *
     * @param 
     */ 
    MainController() ;
    
    /** Start the main controller
     * @returns 
     */
    void start();
    float getDutyCycle();
    float getAmplitude();

    /** Stop the main controller
     * @returns 
     */
    void stop();
    
protected:        
    void control();
    //float calculateAdj();
    float signum(float input);
    float saturate(float input);
    
private:
    ESC esc1;
    
    Timer timer1;
    Ticker ticker1;
    float amp;
    float dutyCycle;
    float curTime;
    float frqMin;
    float frqMax;    
    PwmOut myled;
    AnalogIn mypotentiometer;
    
};
 
#endif