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

Revision:
0:187bb46ed128
Child:
2:040b8c8f4f92
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MainController.h	Wed Jul 29 20:00:59 2015 +0000
@@ -0,0 +1,74 @@
+#ifndef MBED_MAINCONTROLLER_H
+#define MBED_MAINCONTROLLER_H
+ 
+#include "mbed.h"
+#include "PwmIn.h"
+#include "esc.h"
+
+#define MATH_PI 3.14159265359
+
+class MainController {
+public:
+    /** Create a MainController
+     *
+     * @param 
+     */ 
+    MainController() ;
+    
+    /** Start the main controller
+     * @returns 
+     */
+    void start();
+    float getDutyCycle();
+    float getFrequency();
+    float getAmplitude();
+    float getYaw();
+    float getPitch();
+    float getTimeAdd();
+    float getAdj();
+
+    /** Stop the main controller
+     * @returns 
+     */
+    void stop();
+    
+protected:        
+    void control();
+    float calculateFrequency();
+    float calculateAmplitude();
+    float calculateYaw();
+    float calculatePitch();
+    //float calculateAdj();
+    float signum(float input);
+    float saturate(float input);
+    
+private:
+    PwmIn ch1; //yaw
+    PwmIn ch2; //pitch
+    PwmIn ch3; //amp
+    PwmIn ch6; //freq
+    ESC esc1;
+    //Servo leftservo;
+    //Servo rightservo;
+    
+    Timer timer1;
+    Ticker ticker1;
+    float amp;
+    float ampNew;
+    float frq;
+    float dutyCycle;
+    float curTime;
+    float frqMin;
+    float frqMax;
+    float yaw;
+    float pitch;
+    float alPi;
+    //float adj;  
+    bool fullCycle;
+    float frqCmd;
+    float raiser;
+    
+    float throttle_var;
+};
+ 
+#endif
\ No newline at end of file