Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@5:aab0171a8065, 2016-06-16 (annotated)
- Committer:
- Nthu_Five
- Date:
- Thu Jun 16 19:29:17 2016 +0000
- Revision:
- 5:aab0171a8065
- Parent:
- 4:4843445e717a
- Child:
- 6:434bb72ffc26
06170329
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Nthu_Five | 0:1e1b89f64b66 | 1 | |
| Nthu_Five | 0:1e1b89f64b66 | 2 | #include "mbed.h" |
| Nthu_Five | 0:1e1b89f64b66 | 3 | #include "Define.h" |
| Nthu_Five | 0:1e1b89f64b66 | 4 | |
| Nthu_Five | 3:f95202266527 | 5 | |
| Nthu_Five | 0:1e1b89f64b66 | 6 | //////////////////////////////Init |
| Nthu_Five | 0:1e1b89f64b66 | 7 | |
| Nthu_Five | 0:1e1b89f64b66 | 8 | Serial pc(SERIAL_TX, SERIAL_RX); |
| Nthu_Five | 5:aab0171a8065 | 9 | DigitalIn Switch_0(D4); |
| Nthu_Five | 5:aab0171a8065 | 10 | DigitalIn Switch_1(D1); |
| Nthu_Five | 5:aab0171a8065 | 11 | DigitalOut LED_Red(D5); |
| Nthu_Five | 5:aab0171a8065 | 12 | DigitalOut LED_2(A4); |
| Nthu_Five | 5:aab0171a8065 | 13 | DigitalOut LED_3(A5); |
| Nthu_Five | 5:aab0171a8065 | 14 | AnalogIn BatteryVot(A0); |
| Nthu_Five | 5:aab0171a8065 | 15 | //DigitalIn Switch_2(D2); |
| Nthu_Five | 5:aab0171a8065 | 16 | //DigitalIn Switch_3(D3); |
| Nthu_Five | 0:1e1b89f64b66 | 17 | |
| Nthu_Five | 0:1e1b89f64b66 | 18 | |
| Nthu_Five | 0:1e1b89f64b66 | 19 | ////////////////////////////////////////////////////////////////////// |
| Nthu_Five | 0:1e1b89f64b66 | 20 | |
| Nthu_Five | 0:1e1b89f64b66 | 21 | |
| Nthu_Five | 0:1e1b89f64b66 | 22 | /////////////////////////////globle |
| Nthu_Five | 0:1e1b89f64b66 | 23 | double NowCoordinate[2]; |
| Nthu_Five | 0:1e1b89f64b66 | 24 | double NowFaceAngle, NowDirectionInRad; |
| Nthu_Five | 0:1e1b89f64b66 | 25 | long SelfRotation; |
| Nthu_Five | 0:1e1b89f64b66 | 26 | double TargetCoordinate[2]; |
| Nthu_Five | 5:aab0171a8065 | 27 | double Goal_1_Coordinate[2], Goal_2_Coordinate[2], Ball_Coordinate[2], Last_Ball_Coordinate[2], Enemy_Ball_Coordinate[2];//, Ball_2_Coordinate[2]; |
| Nthu_Five | 0:1e1b89f64b66 | 28 | bool TargetCoordinateValid; |
| Nthu_Five | 2:4a65758cf752 | 29 | double Car1XforStra1, Car1YforStra1, Car1DirectionforStra1, BlueBallXforStra1, BlueBallYforStra1, GreenBallXforStra1, GreenBallYforStra1; |
| Nthu_Five | 3:f95202266527 | 30 | double Car2XforStra1, Car2YforStra1, Car2DirectionforStra1; |
| Nthu_Five | 0:1e1b89f64b66 | 31 | |
| Nthu_Five | 0:1e1b89f64b66 | 32 | |
| Nthu_Five | 0:1e1b89f64b66 | 33 | ///////////////////////////////////////// |
| Nthu_Five | 4:4843445e717a | 34 | |
| Nthu_Five | 2:4a65758cf752 | 35 | #include "DebugBluetooth.h" |
| Nthu_Five | 0:1e1b89f64b66 | 36 | #include "OutputToMotor.h" |
| Nthu_Five | 0:1e1b89f64b66 | 37 | #include "Interrupt.h" |
| Nthu_Five | 3:f95202266527 | 38 | |
| Nthu_Five | 4:4843445e717a | 39 | //#include "bluetooth.h" |
| Nthu_Five | 3:f95202266527 | 40 | #include "NewBluetooth.h" |
| Nthu_Five | 0:1e1b89f64b66 | 41 | #include "strategy1.h" |
| Nthu_Five | 0:1e1b89f64b66 | 42 | #include "setup.h" |
| Nthu_Five | 0:1e1b89f64b66 | 43 | #include "loop.h" |
| Nthu_Five | 0:1e1b89f64b66 | 44 | #include "Function.h" |
| Nthu_Five | 0:1e1b89f64b66 | 45 | |
| Nthu_Five | 0:1e1b89f64b66 | 46 | |
| Nthu_Five | 3:f95202266527 | 47 | |
| Nthu_Five | 0:1e1b89f64b66 | 48 | void InitIO(void) |
| Nthu_Five | 0:1e1b89f64b66 | 49 | { |
| Nthu_Five | 5:aab0171a8065 | 50 | Switch_0.mode(PullUp); |
| Nthu_Five | 5:aab0171a8065 | 51 | Switch_1.mode(PullUp); |
| Nthu_Five | 5:aab0171a8065 | 52 | //Switch_2.mode(PullUp); |
| Nthu_Five | 5:aab0171a8065 | 53 | //Switch_3.mode(PullUp); |
| Nthu_Five | 5:aab0171a8065 | 54 | LED_2 = 0; |
| Nthu_Five | 5:aab0171a8065 | 55 | LED_3 = 0; |
| Nthu_Five | 0:1e1b89f64b66 | 56 | } |
| Nthu_Five | 0:1e1b89f64b66 | 57 | |
| Nthu_Five | 0:1e1b89f64b66 | 58 | int main() |
| Nthu_Five | 0:1e1b89f64b66 | 59 | { |
| Nthu_Five | 0:1e1b89f64b66 | 60 | InitIO(); |
| Nthu_Five | 0:1e1b89f64b66 | 61 | setup(); |
| Nthu_Five | 0:1e1b89f64b66 | 62 | OutputInit(); |
| Nthu_Five | 0:1e1b89f64b66 | 63 | while(1) |
| Nthu_Five | 0:1e1b89f64b66 | 64 | { |
| Nthu_Five | 0:1e1b89f64b66 | 65 | loop(); |
| Nthu_Five | 3:f95202266527 | 66 | |
| Nthu_Five | 0:1e1b89f64b66 | 67 | } |
| Nthu_Five | 0:1e1b89f64b66 | 68 | } |