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: TargetManager mbed
main.cpp@5:e9c15bafd93f, 2017-03-12 (annotated)
- Committer:
- dupm2216
- Date:
- Sun Mar 12 00:55:20 2017 +0000
- Revision:
- 5:e9c15bafd93f
- Parent:
- 4:535d32238a43
- Child:
- 6:07147a130219
Decouple TargetTicker from TargetManager
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dupm2216 | 0:fc00abeafce9 | 1 | #include "mbed.h" |
| dupm2216 | 3:0169a6a1ca10 | 2 | #include "Bumper.hpp" |
| dupm2216 | 4:535d32238a43 | 3 | #include "TargetHitCallback.hpp" |
| dupm2216 | 0:fc00abeafce9 | 4 | #include "TargetManager.hpp" |
| dupm2216 | 5:e9c15bafd93f | 5 | #include "TargetMissedCallback.hpp" |
| dupm2216 | 3:0169a6a1ca10 | 6 | #include "TargetTicker.hpp" |
| dupm2216 | 0:fc00abeafce9 | 7 | |
| dupm2216 | 0:fc00abeafce9 | 8 | int main() |
| dupm2216 | 0:fc00abeafce9 | 9 | { |
| dupm2216 | 3:0169a6a1ca10 | 10 | printf("Start TargetManager manual test\r\n"); |
| dupm2216 | 3:0169a6a1ca10 | 11 | |
| dupm2216 | 0:fc00abeafce9 | 12 | PinName bumper_pin = p5; |
| dupm2216 | 0:fc00abeafce9 | 13 | |
| dupm2216 | 5:e9c15bafd93f | 14 | TargetTicker target_ticker; |
| dupm2216 | 3:0169a6a1ca10 | 15 | TargetManager target_manager(target_ticker); |
| dupm2216 | 3:0169a6a1ca10 | 16 | |
| dupm2216 | 4:535d32238a43 | 17 | TargetHitCallback target_hit_callback(target_manager, 42); |
| dupm2216 | 5:e9c15bafd93f | 18 | TargetMissedCallback target_missed_callback(target_manager, 42); |
| dupm2216 | 5:e9c15bafd93f | 19 | target_ticker.init(&target_missed_callback); |
| dupm2216 | 5:e9c15bafd93f | 20 | |
| dupm2216 | 4:535d32238a43 | 21 | Bumper bumper(bumper_pin, target_hit_callback); |
| dupm2216 | 4:535d32238a43 | 22 | |
| dupm2216 | 0:fc00abeafce9 | 23 | while(true) |
| dupm2216 | 0:fc00abeafce9 | 24 | { |
| dupm2216 | 3:0169a6a1ca10 | 25 | target_ticker.start(500); |
| dupm2216 | 3:0169a6a1ca10 | 26 | wait_ms(1000); |
| dupm2216 | 0:fc00abeafce9 | 27 | } |
| dupm2216 | 0:fc00abeafce9 | 28 | } |