
Don't want to screw something by updating the code as Ivelin updated himself while I was writing so I am forking it.
Dependencies: LocalPositionSystem MMA8451Q Motor_Driver Sensors mbed
Fork of TDP_main by
Shooting_fun.cpp@25:8be440e10126, 2015-03-22 (annotated)
- Committer:
- Bartas
- Date:
- Sun Mar 22 23:55:20 2015 +0000
- Revision:
- 25:8be440e10126
- Parent:
- 12:bb21b76b6375
All the cases and turns theoretical code. Some could be missing and needs experimentation. Got rid of "goto" call.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
orsharp | 12:bb21b76b6375 | 1 | // |
orsharp | 12:bb21b76b6375 | 2 | //#include "MMA8451Q.h" |
orsharp | 12:bb21b76b6375 | 3 | // |
orsharp | 12:bb21b76b6375 | 4 | //#define MMA8451_I2C_ADDRESS (0x1d<<1) |
orsharp | 12:bb21b76b6375 | 5 | // |
orsharp | 12:bb21b76b6375 | 6 | // |
orsharp | 12:bb21b76b6375 | 7 | //MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); |
orsharp | 12:bb21b76b6375 | 8 | // int fire = 0; |
orsharp | 12:bb21b76b6375 | 9 | // while (1) { |
orsharp | 12:bb21b76b6375 | 10 | // fire = 0; |
orsharp | 12:bb21b76b6375 | 11 | // if (abs(acc.getAccY()) > 0.5f){ |
orsharp | 12:bb21b76b6375 | 12 | // fire = 1; |
orsharp | 12:bb21b76b6375 | 13 | // } |
orsharp | 12:bb21b76b6375 | 14 | // shoot( (1.0 - abs(acc.getAccX())), fire); |
orsharp | 12:bb21b76b6375 | 15 | // wait(0.2); |
orsharp | 12:bb21b76b6375 | 16 | // } |
orsharp | 12:bb21b76b6375 | 17 | |
orsharp | 12:bb21b76b6375 | 18 | |
orsharp | 12:bb21b76b6375 | 19 | // TESTING FOR SHOOTER |
orsharp | 12:bb21b76b6375 | 20 | //int count = 0; |
orsharp | 12:bb21b76b6375 | 21 | // while (1) { |
orsharp | 12:bb21b76b6375 | 22 | // count = count%4; |
orsharp | 12:bb21b76b6375 | 23 | // if (count == 0) { |
orsharp | 12:bb21b76b6375 | 24 | // shoot(0.0); |
orsharp | 12:bb21b76b6375 | 25 | // wait(1); |
orsharp | 12:bb21b76b6375 | 26 | // } |
orsharp | 12:bb21b76b6375 | 27 | // else { |
orsharp | 12:bb21b76b6375 | 28 | // shoot (0.3*(float)count); |
orsharp | 12:bb21b76b6375 | 29 | // wait(0.2); |
orsharp | 12:bb21b76b6375 | 30 | // } |
orsharp | 12:bb21b76b6375 | 31 | // count ++; |
orsharp | 12:bb21b76b6375 | 32 | // } |