![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tuk tutoriail
Dependencies: mbed lib_workshop_2019
main.cpp@1:7a8764e627b5, 2019-10-23 (annotated)
- Committer:
- gvaquette
- Date:
- Wed Oct 23 13:01:35 2019 +0000
- Revision:
- 1:7a8764e627b5
- Parent:
- 0:0a75a79d6b77
- Child:
- 2:8153195b1672
test ULTRASONIC and COMPASS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gvaquette | 0:0a75a79d6b77 | 1 | #include "mbed.h" |
gvaquette | 1:7a8764e627b5 | 2 | |
gvaquette | 0:0a75a79d6b77 | 3 | #include "console_output.h" |
gvaquette | 1:7a8764e627b5 | 4 | #include "test_us.h" |
gvaquette | 1:7a8764e627b5 | 5 | #include "test_compass.h" |
gvaquette | 1:7a8764e627b5 | 6 | |
gvaquette | 1:7a8764e627b5 | 7 | #include "pin_connexions.h" |
gvaquette | 1:7a8764e627b5 | 8 | |
gvaquette | 1:7a8764e627b5 | 9 | |
gvaquette | 0:0a75a79d6b77 | 10 | |
gvaquette | 0:0a75a79d6b77 | 11 | Serial pc (PA_2, PA_3, 115200); |
gvaquette | 0:0a75a79d6b77 | 12 | |
gvaquette | 0:0a75a79d6b77 | 13 | int main() { |
gvaquette | 1:7a8764e627b5 | 14 | e_test user_choice ; |
gvaquette | 0:0a75a79d6b77 | 15 | ft_print_test_menu(pc); |
gvaquette | 1:7a8764e627b5 | 16 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 17 | |
gvaquette | 1:7a8764e627b5 | 18 | while(1) |
gvaquette | 1:7a8764e627b5 | 19 | { |
gvaquette | 1:7a8764e627b5 | 20 | switch (user_choice) |
gvaquette | 1:7a8764e627b5 | 21 | { |
gvaquette | 1:7a8764e627b5 | 22 | case ULTRASONIC : |
gvaquette | 1:7a8764e627b5 | 23 | do |
gvaquette | 1:7a8764e627b5 | 24 | { |
gvaquette | 1:7a8764e627b5 | 25 | ft_print_all_values_US(ultra_sonic, pc); |
gvaquette | 1:7a8764e627b5 | 26 | } while (!pc.readable()); |
gvaquette | 1:7a8764e627b5 | 27 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 28 | pc.printf("\n"); |
gvaquette | 1:7a8764e627b5 | 29 | break; |
gvaquette | 1:7a8764e627b5 | 30 | |
gvaquette | 1:7a8764e627b5 | 31 | case COMPASS : |
gvaquette | 1:7a8764e627b5 | 32 | do |
gvaquette | 1:7a8764e627b5 | 33 | { |
gvaquette | 1:7a8764e627b5 | 34 | ft_print_compass_values(compass, pc); |
gvaquette | 1:7a8764e627b5 | 35 | } while (!pc.readable()); |
gvaquette | 1:7a8764e627b5 | 36 | pc.printf("\n"); |
gvaquette | 1:7a8764e627b5 | 37 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 38 | break; |
gvaquette | 1:7a8764e627b5 | 39 | default : |
gvaquette | 1:7a8764e627b5 | 40 | ft_print_test_menu(pc); |
gvaquette | 1:7a8764e627b5 | 41 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 42 | break; |
gvaquette | 1:7a8764e627b5 | 43 | } |
gvaquette | 1:7a8764e627b5 | 44 | } |
gvaquette | 1:7a8764e627b5 | 45 | |
gvaquette | 0:0a75a79d6b77 | 46 | } |