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@27:df11ab63cda4, 2017-03-06 (annotated)
- Committer:
- cittecla
- Date:
- Mon Mar 06 15:10:24 2017 +0000
- Revision:
- 27:df11ab63cda4
- Parent:
- 25:08ee4525155b
- Child:
- 29:e7d0208bf2af
Implemented encoder counter
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 | 27:df11ab63cda4 | 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 | 27:df11ab63cda4 | 12 | #include "movement.h" |
| cittecla | 27:df11ab63cda4 | 13 | #include "EncoderCounter.h" |
| cittecla | 18:a82994e67297 | 14 | |
| cittecla | 18:a82994e67297 | 15 | |
| cittecla | 18:a82994e67297 | 16 | //Perophery for distance sensors |
| cittecla | 18:a82994e67297 | 17 | AnalogIn distance(PB_1); |
| cittecla | 18:a82994e67297 | 18 | DigitalOut enable(PC_1); |
| cittecla | 18:a82994e67297 | 19 | DigitalOut bit0(PH_1); |
| cittecla | 18:a82994e67297 | 20 | DigitalOut bit1(PC_2); |
| cittecla | 18:a82994e67297 | 21 | DigitalOut bit2(PC_3); |
| cittecla | 18:a82994e67297 | 22 | IRSensor sensors[6]; |
| cittecla | 18:a82994e67297 | 23 | |
| cittecla | 18:a82994e67297 | 24 | //indicator leds arround robot |
| cittecla | 18:a82994e67297 | 25 | DigitalOut leds[] = { PC_8, PC_6, PB_12, PA_7, PC_0, PC_9 }; |
| cittecla | 25:08ee4525155b | 26 | |
| cittecla | 19:baa8371d55b4 | 27 | |
| cittecla | 18:a82994e67297 | 28 | |
| cittecla | 18:a82994e67297 | 29 | |
| cittecla | 18:a82994e67297 | 30 | static double time_counter = 0.0f; |
| cittecla | 18:a82994e67297 | 31 | static double timer0 = 0.0f; |
| cittecla | 18:a82994e67297 | 32 | bool status = 0; |
| cittecla | 18:a82994e67297 | 33 | |
| cittecla | 18:a82994e67297 | 34 | int main() |
| cittecla | 18:a82994e67297 | 35 | { |
| cittecla | 19:baa8371d55b4 | 36 | move_init(); |
| cittecla | 24:6c2fec64f890 | 37 | while(1) { |
| cittecla | 27:df11ab63cda4 | 38 | sync_movement(false,true); |
| cittecla | 24:6c2fec64f890 | 39 | } |
| cittecla | 25:08ee4525155b | 40 | } |
| cittecla | 25:08ee4525155b | 41 | |
| cittecla | 24:6c2fec64f890 | 42 | |
| cittecla | 24:6c2fec64f890 | 43 | |
| cittecla | 25:08ee4525155b | 44 |
