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
motor_controller.h@6:a4d6f3e4bf28, 2014-01-29 (annotated)
- Committer:
- rkk
- Date:
- Wed Jan 29 05:04:50 2014 +0000
- Revision:
- 6:a4d6f3e4bf28
- Parent:
- 0:ff9bc5f69c57
- Child:
- 7:e005cfaff8d1
added pam ira
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sandwich | 0:ff9bc5f69c57 | 1 | #pragma once |
sandwich | 0:ff9bc5f69c57 | 2 | #include "mbed.h" |
rkk | 6:a4d6f3e4bf28 | 3 | #define MATH_PI 3.14159265359 |
rkk | 6:a4d6f3e4bf28 | 4 | #define FREQ_MIN 0.5 //Hz |
rkk | 6:a4d6f3e4bf28 | 5 | #define FREQ_MAX 8 //Hz |
sandwich | 0:ff9bc5f69c57 | 6 | |
sandwich | 0:ff9bc5f69c57 | 7 | class PololuMController |
sandwich | 0:ff9bc5f69c57 | 8 | { |
sandwich | 0:ff9bc5f69c57 | 9 | private: |
sandwich | 0:ff9bc5f69c57 | 10 | PwmOut* pwm; |
sandwich | 0:ff9bc5f69c57 | 11 | DigitalOut* outA; |
sandwich | 0:ff9bc5f69c57 | 12 | DigitalOut* outB; |
sandwich | 0:ff9bc5f69c57 | 13 | float timestamp; |
sandwich | 0:ff9bc5f69c57 | 14 | public: |
sandwich | 0:ff9bc5f69c57 | 15 | PololuMController(); |
sandwich | 0:ff9bc5f69c57 | 16 | PololuMController(PinName pwmport, PinName A, PinName B); |
sandwich | 0:ff9bc5f69c57 | 17 | ~PololuMController(); |
sandwich | 0:ff9bc5f69c57 | 18 | void setspeed(float speed); //0 to 1 |
sandwich | 0:ff9bc5f69c57 | 19 | void setpolarspeed(float speed); //-1 to 1 |
sandwich | 0:ff9bc5f69c57 | 20 | void reverse(); //only works on non-polar speed |
rkk | 6:a4d6f3e4bf28 | 21 | void drive_sinusoidal(float currentTime, float dutyCycle, float frequency); |
sandwich | 0:ff9bc5f69c57 | 22 | }; |