![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tuk tutoriail
Dependencies: mbed lib_workshop_2019
main.cpp@3:a0e37b8918ac, 2019-10-23 (annotated)
- Committer:
- gvaquette
- Date:
- Wed Oct 23 14:01:59 2019 +0000
- Revision:
- 3:a0e37b8918ac
- Parent:
- 2:8153195b1672
- Child:
- 4:bf5caf4c0c88
Add print non implemented
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 | 2:8153195b1672 | 6 | #include "test_cny.h" |
gvaquette | 1:7a8764e627b5 | 7 | |
gvaquette | 1:7a8764e627b5 | 8 | #include "pin_connexions.h" |
gvaquette | 1:7a8764e627b5 | 9 | |
gvaquette | 1:7a8764e627b5 | 10 | |
gvaquette | 0:0a75a79d6b77 | 11 | |
gvaquette | 0:0a75a79d6b77 | 12 | Serial pc (PA_2, PA_3, 115200); |
gvaquette | 0:0a75a79d6b77 | 13 | |
gvaquette | 0:0a75a79d6b77 | 14 | int main() { |
gvaquette | 1:7a8764e627b5 | 15 | e_test user_choice ; |
gvaquette | 0:0a75a79d6b77 | 16 | ft_print_test_menu(pc); |
gvaquette | 1:7a8764e627b5 | 17 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 18 | |
gvaquette | 1:7a8764e627b5 | 19 | while(1) |
gvaquette | 1:7a8764e627b5 | 20 | { |
gvaquette | 1:7a8764e627b5 | 21 | switch (user_choice) |
gvaquette | 1:7a8764e627b5 | 22 | { |
gvaquette | 1:7a8764e627b5 | 23 | case ULTRASONIC : |
gvaquette | 1:7a8764e627b5 | 24 | do |
gvaquette | 1:7a8764e627b5 | 25 | { |
gvaquette | 1:7a8764e627b5 | 26 | ft_print_all_values_US(ultra_sonic, pc); |
gvaquette | 1:7a8764e627b5 | 27 | } while (!pc.readable()); |
gvaquette | 1:7a8764e627b5 | 28 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 29 | pc.printf("\n"); |
gvaquette | 1:7a8764e627b5 | 30 | break; |
gvaquette | 1:7a8764e627b5 | 31 | |
gvaquette | 1:7a8764e627b5 | 32 | case COMPASS : |
gvaquette | 1:7a8764e627b5 | 33 | do |
gvaquette | 1:7a8764e627b5 | 34 | { |
gvaquette | 1:7a8764e627b5 | 35 | ft_print_compass_values(compass, pc); |
gvaquette | 1:7a8764e627b5 | 36 | } while (!pc.readable()); |
gvaquette | 1:7a8764e627b5 | 37 | pc.printf("\n"); |
gvaquette | 1:7a8764e627b5 | 38 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 39 | break; |
gvaquette | 2:8153195b1672 | 40 | |
gvaquette | 2:8153195b1672 | 41 | case CNY70 : |
gvaquette | 2:8153195b1672 | 42 | do |
gvaquette | 2:8153195b1672 | 43 | { |
gvaquette | 2:8153195b1672 | 44 | pc.printf("\r CNY_1"); |
gvaquette | 2:8153195b1672 | 45 | ft_print_cny_analog_voltage(CNY1, pc); |
gvaquette | 2:8153195b1672 | 46 | pc.printf("\t CNY_2"); |
gvaquette | 2:8153195b1672 | 47 | ft_print_cny_analog_voltage(CNY2, pc); |
gvaquette | 2:8153195b1672 | 48 | pc.printf("\t CNY_3"); |
gvaquette | 2:8153195b1672 | 49 | ft_print_cny_analog_voltage(CNY3, pc); |
gvaquette | 2:8153195b1672 | 50 | } while (!pc.readable()); |
gvaquette | 2:8153195b1672 | 51 | pc.printf("\n"); |
gvaquette | 2:8153195b1672 | 52 | user_choice = ft_get_user_choice(pc); |
gvaquette | 2:8153195b1672 | 53 | break; |
gvaquette | 3:a0e37b8918ac | 54 | |
gvaquette | 3:a0e37b8918ac | 55 | case VBAT : |
gvaquette | 3:a0e37b8918ac | 56 | do |
gvaquette | 3:a0e37b8918ac | 57 | { |
gvaquette | 3:a0e37b8918ac | 58 | ft_print_to_be_imp(pc); |
gvaquette | 3:a0e37b8918ac | 59 | } while (!pc.readable()); |
gvaquette | 3:a0e37b8918ac | 60 | pc.printf("\n"); |
gvaquette | 3:a0e37b8918ac | 61 | user_choice = ft_get_user_choice(pc); |
gvaquette | 3:a0e37b8918ac | 62 | break; |
gvaquette | 3:a0e37b8918ac | 63 | |
gvaquette | 3:a0e37b8918ac | 64 | case LEFT_MOTOR : |
gvaquette | 3:a0e37b8918ac | 65 | do |
gvaquette | 3:a0e37b8918ac | 66 | { |
gvaquette | 3:a0e37b8918ac | 67 | ft_print_to_be_imp(pc); |
gvaquette | 3:a0e37b8918ac | 68 | } while (!pc.readable()); |
gvaquette | 3:a0e37b8918ac | 69 | pc.printf("\n"); |
gvaquette | 3:a0e37b8918ac | 70 | user_choice = ft_get_user_choice(pc); |
gvaquette | 3:a0e37b8918ac | 71 | break; |
gvaquette | 3:a0e37b8918ac | 72 | |
gvaquette | 3:a0e37b8918ac | 73 | case RIGHT_MOTOR: |
gvaquette | 3:a0e37b8918ac | 74 | do |
gvaquette | 3:a0e37b8918ac | 75 | { |
gvaquette | 3:a0e37b8918ac | 76 | ft_print_to_be_imp(pc); |
gvaquette | 3:a0e37b8918ac | 77 | } while (!pc.readable()); |
gvaquette | 3:a0e37b8918ac | 78 | pc.printf("\n"); |
gvaquette | 3:a0e37b8918ac | 79 | user_choice = ft_get_user_choice(pc); |
gvaquette | 3:a0e37b8918ac | 80 | break; |
gvaquette | 3:a0e37b8918ac | 81 | |
gvaquette | 2:8153195b1672 | 82 | |
gvaquette | 1:7a8764e627b5 | 83 | default : |
gvaquette | 1:7a8764e627b5 | 84 | ft_print_test_menu(pc); |
gvaquette | 1:7a8764e627b5 | 85 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 86 | break; |
gvaquette | 1:7a8764e627b5 | 87 | } |
gvaquette | 1:7a8764e627b5 | 88 | } |
gvaquette | 1:7a8764e627b5 | 89 | |
gvaquette | 0:0a75a79d6b77 | 90 | } |