![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
the fish that looks like a jet
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo
motor_controller.h
- Committer:
- rkk
- Date:
- 2014-01-31
- Revision:
- 10:d9f1037f0cb0
- Parent:
- 8:0574a5db1fc4
- Child:
- 11:8ec915eb70f6
File content as of revision 10:d9f1037f0cb0:
#pragma once #include "mbed.h" #define MATH_PI 3.14159265359 #define FREQ_MIN 0.5 //Hz #define FREQ_MAX 3 //Hz float sigm(float input); class PololuMController { private: PwmOut* pwm; DigitalOut* outA; DigitalOut* outB; float timestamp; //for driving float phi1, ome1,amp1; bool firstTime; public: PololuMController(); PololuMController(PinName pwmport, PinName A, PinName B); ~PololuMController(); void setspeed(float speed); //0 to 1 void setpolarspeed(float speed); //-1 to 1 void reverse(); //only works on non-polar speed float drive_sinusoidal(float currentTime, float amplitude, float frequency); void drive_rectangular(float currentTime, float amplitude, float frequency); };