![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
the fish that looks like a jet
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo
main.cpp@0:ff9bc5f69c57, 2014-01-21 (annotated)
- Committer:
- sandwich
- Date:
- Tue Jan 21 21:32:05 2014 +0000
- Revision:
- 0:ff9bc5f69c57
- Child:
- 1:80e0af42f876
- Child:
- 2:430c068cf570
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 | #include "mbed.h" |
sandwich | 0:ff9bc5f69c57 | 2 | #include "motor_controller.h" |
sandwich | 0:ff9bc5f69c57 | 3 | #include "IMU.h" |
sandwich | 0:ff9bc5f69c57 | 4 | |
sandwich | 0:ff9bc5f69c57 | 5 | PololuMController mcon(p22, p6, p5); |
sandwich | 0:ff9bc5f69c57 | 6 | IMU imu(0.1, 0.3, 0.005, 0.005); |
sandwich | 0:ff9bc5f69c57 | 7 | |
sandwich | 0:ff9bc5f69c57 | 8 | int main() { |
sandwich | 0:ff9bc5f69c57 | 9 | Timer t; |
sandwich | 0:ff9bc5f69c57 | 10 | t.start(); |
sandwich | 0:ff9bc5f69c57 | 11 | while(1) { |
sandwich | 0:ff9bc5f69c57 | 12 | /* if (speed>=1) |
sandwich | 0:ff9bc5f69c57 | 13 | { |
sandwich | 0:ff9bc5f69c57 | 14 | speed=0; |
sandwich | 0:ff9bc5f69c57 | 15 | mcon.reverse(); |
sandwich | 0:ff9bc5f69c57 | 16 | } |
sandwich | 0:ff9bc5f69c57 | 17 | mcon.setspeed(speed); |
sandwich | 0:ff9bc5f69c57 | 18 | */ |
sandwich | 0:ff9bc5f69c57 | 19 | mcon.drive_sinusoidal(t.read(), 1, 0.25*3.14, 0); |
sandwich | 0:ff9bc5f69c57 | 20 | wait(0.2); |
sandwich | 0:ff9bc5f69c57 | 21 | } |
sandwich | 0:ff9bc5f69c57 | 22 | t.stop(); |
sandwich | 0:ff9bc5f69c57 | 23 | } |