![](/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@0:ff9bc5f69c57, 2014-01-21 (annotated)
- Committer:
- sandwich
- Date:
- Tue Jan 21 21:32:05 2014 +0000
- Revision:
- 0:ff9bc5f69c57
- Child:
- 6:a4d6f3e4bf28
pololu motor controller works with sine waveform input. IMU is untested
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" |
sandwich | 0:ff9bc5f69c57 | 3 | |
sandwich | 0:ff9bc5f69c57 | 4 | class PololuMController |
sandwich | 0:ff9bc5f69c57 | 5 | { |
sandwich | 0:ff9bc5f69c57 | 6 | private: |
sandwich | 0:ff9bc5f69c57 | 7 | PwmOut* pwm; |
sandwich | 0:ff9bc5f69c57 | 8 | DigitalOut* outA; |
sandwich | 0:ff9bc5f69c57 | 9 | DigitalOut* outB; |
sandwich | 0:ff9bc5f69c57 | 10 | float timestamp; |
sandwich | 0:ff9bc5f69c57 | 11 | public: |
sandwich | 0:ff9bc5f69c57 | 12 | PololuMController(); |
sandwich | 0:ff9bc5f69c57 | 13 | PololuMController(PinName pwmport, PinName A, PinName B); |
sandwich | 0:ff9bc5f69c57 | 14 | ~PololuMController(); |
sandwich | 0:ff9bc5f69c57 | 15 | void setspeed(float speed); //0 to 1 |
sandwich | 0:ff9bc5f69c57 | 16 | void setpolarspeed(float speed); //-1 to 1 |
sandwich | 0:ff9bc5f69c57 | 17 | void reverse(); //only works on non-polar speed |
sandwich | 0:ff9bc5f69c57 | 18 | void drive_sinusoidal(float cur_time, float a, float w, float phi); //a*sin(w*cur_time+phi) |
sandwich | 0:ff9bc5f69c57 | 19 | }; |