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
Fork of Robocode by
source/main.cpp@21:cb40c0533bc2, 2017-03-02 (annotated)
- Committer:
- cittecla
- Date:
- Thu Mar 02 20:07:41 2017 +0000
- Revision:
- 21:cb40c0533bc2
- Parent:
- 19:baa8371d55b4
- Child:
- 22:c8e187b9d949
Synchronous test failed
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cittecla | 18:a82994e67297 | 1 | /** |
| cittecla | 18:a82994e67297 | 2 | * Main File of Robocode |
| cittecla | 18:a82994e67297 | 3 | * Handels parallel processing and interupts |
| cittecla | 18:a82994e67297 | 4 | * Version 0.0.1 |
| cittecla | 18:a82994e67297 | 5 | * PES2 Gruppe 1 |
| cittecla | 18:a82994e67297 | 6 | **/ |
| cittecla | 18:a82994e67297 | 7 | |
| cittecla | 18:a82994e67297 | 8 | #include "mbed.h" |
| cittecla | 18:a82994e67297 | 9 | #include "pathfinding.h" |
| cittecla | 18:a82994e67297 | 10 | #include "time.h" |
| cittecla | 18:a82994e67297 | 11 | #include "IRsensor.h" |
| cittecla | 18:a82994e67297 | 12 | #include "move.h" |
| cittecla | 18:a82994e67297 | 13 | |
| cittecla | 18:a82994e67297 | 14 | //static double time_counter = 0.0f; |
| cittecla | 18:a82994e67297 | 15 | //static double deltatime = 0.0f; |
| cittecla | 18:a82994e67297 | 16 | |
| cittecla | 21:cb40c0533bc2 | 17 | //DigitalOut led(LED1); // Board LED |
| cittecla | 18:a82994e67297 | 18 | |
| cittecla | 18:a82994e67297 | 19 | //Perophery for distance sensors |
| cittecla | 18:a82994e67297 | 20 | AnalogIn distance(PB_1); |
| cittecla | 18:a82994e67297 | 21 | DigitalOut enable(PC_1); |
| cittecla | 18:a82994e67297 | 22 | DigitalOut bit0(PH_1); |
| cittecla | 18:a82994e67297 | 23 | DigitalOut bit1(PC_2); |
| cittecla | 18:a82994e67297 | 24 | DigitalOut bit2(PC_3); |
| cittecla | 18:a82994e67297 | 25 | IRSensor sensors[6]; |
| cittecla | 18:a82994e67297 | 26 | |
| cittecla | 18:a82994e67297 | 27 | //indicator leds arround robot |
| cittecla | 18:a82994e67297 | 28 | DigitalOut leds[] = { PC_8, PC_6, PB_12, PA_7, PC_0, PC_9 }; |
| cittecla | 18:a82994e67297 | 29 | |
| cittecla | 19:baa8371d55b4 | 30 | |
| cittecla | 18:a82994e67297 | 31 | |
| cittecla | 18:a82994e67297 | 32 | |
| cittecla | 18:a82994e67297 | 33 | |
| cittecla | 18:a82994e67297 | 34 | static double time_counter = 0.0f; |
| cittecla | 18:a82994e67297 | 35 | static double timer0 = 0.0f; |
| cittecla | 18:a82994e67297 | 36 | bool status = 0; |
| cittecla | 18:a82994e67297 | 37 | |
| cittecla | 18:a82994e67297 | 38 | int main() |
| cittecla | 18:a82994e67297 | 39 | { |
| cittecla | 19:baa8371d55b4 | 40 | move_init(); |
| cittecla | 21:cb40c0533bc2 | 41 | while(1){ |
| cittecla | 21:cb40c0533bc2 | 42 | sync_movement(false,true); |
| cittecla | 21:cb40c0533bc2 | 43 | } |
| cittecla | 18:a82994e67297 | 44 | /* while(1){ |
| cittecla | 18:a82994e67297 | 45 | if(status == 1){ |
| cittecla | 18:a82994e67297 | 46 | led = 0; |
| cittecla | 18:a82994e67297 | 47 | wait(0.5); |
| cittecla | 18:a82994e67297 | 48 | status = 0; |
| cittecla | 18:a82994e67297 | 49 | }else{ |
| cittecla | 18:a82994e67297 | 50 | led = 1; |
| cittecla | 18:a82994e67297 | 51 | timer0 = 0.0f; |
| cittecla | 18:a82994e67297 | 52 | pathfinding(); |
| cittecla | 18:a82994e67297 | 53 | status = 1; |
| cittecla | 18:a82994e67297 | 54 | } |
| cittecla | 18:a82994e67297 | 55 | }*/ |
| cittecla | 18:a82994e67297 | 56 | } |
| cittecla | 18:a82994e67297 | 57 | |
| cittecla | 21:cb40c0533bc2 | 58 |
