My modifications/additions to the code
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 Servo fishgait mbed-rtos mbed pixy_cam
Fork of robotic_fish_ver_4_8 by
Diff: MainController.h
- Revision:
- 11:8ec915eb70f6
- Child:
- 12:7eeb29892625
diff -r d9f1037f0cb0 -r 8ec915eb70f6 MainController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MainController.h Fri Jan 31 19:36:28 2014 +0000 @@ -0,0 +1,62 @@ +#ifndef MBED_MAINCONTROLLER_H +#define MBED_MAINCONTROLLER_H + +#include "mbed.h" +#include "PwmIn.h" +#include "motor_controller.h" + +#define MATH_PI 3.14159265359 + +/** MainController class to get control inputs and place them onto the system + * + * + */ +class MainController { +public: + /** Create a MainController + * + * @param + */ + MainController() ; + + /** Start the main controller + * + * @returns + */ + void start(); + + float getDutyCycle(); + float getFrequency(); + float getVolume(); + float getAmplitude(); + + /** Stop the main controller + * + * @returns + */ + void stop(); + + +protected: + void control(); + float calculateFrequency(); + float calculateVolume(); + +private: + PwmIn ch3; + PwmIn ch6; + PololuMController mcon; + Timer timer1; + Ticker ticker1; + float vol; + float frq; + float dutyCycle; + float curTime; + float frqMin; + float frqMax; + float amplitude; +}; + +#endif + +