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
main.cpp@1:80e0af42f876, 2014-01-21 (annotated)
- Committer:
- rkk
- Date:
- Tue Jan 21 23:47:08 2014 +0000
- Revision:
- 1:80e0af42f876
- Parent:
- 0:ff9bc5f69c57
- Child:
- 3:666c1bae1a34
comment added
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 | |
rkk | 1:80e0af42f876 | 8 | //main() |
sandwich | 0:ff9bc5f69c57 | 9 | int main() { |
sandwich | 0:ff9bc5f69c57 | 10 | Timer t; |
sandwich | 0:ff9bc5f69c57 | 11 | t.start(); |
sandwich | 0:ff9bc5f69c57 | 12 | while(1) { |
sandwich | 0:ff9bc5f69c57 | 13 | /* if (speed>=1) |
sandwich | 0:ff9bc5f69c57 | 14 | { |
sandwich | 0:ff9bc5f69c57 | 15 | speed=0; |
sandwich | 0:ff9bc5f69c57 | 16 | mcon.reverse(); |
sandwich | 0:ff9bc5f69c57 | 17 | } |
sandwich | 0:ff9bc5f69c57 | 18 | mcon.setspeed(speed); |
sandwich | 0:ff9bc5f69c57 | 19 | */ |
sandwich | 0:ff9bc5f69c57 | 20 | mcon.drive_sinusoidal(t.read(), 1, 0.25*3.14, 0); |
sandwich | 0:ff9bc5f69c57 | 21 | wait(0.2); |
sandwich | 0:ff9bc5f69c57 | 22 | } |
sandwich | 0:ff9bc5f69c57 | 23 | t.stop(); |
sandwich | 0:ff9bc5f69c57 | 24 | } |