![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tuk tutoriail
Dependencies: mbed lib_workshop_2019
main.cpp@9:19255172362f, 2019-10-28 (annotated)
- Committer:
- gvaquette
- Date:
- Mon Oct 28 05:29:08 2019 +0000
- Revision:
- 9:19255172362f
- Parent:
- 8:c2d06715025f
- Child:
- 10:2c17068cb551
Version pour whorkshop v2
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 | 4:bf5caf4c0c88 | 7 | #include "test_motor.h" |
gvaquette | 1:7a8764e627b5 | 8 | |
gvaquette | 1:7a8764e627b5 | 9 | #include "pin_connexions.h" |
gvaquette | 1:7a8764e627b5 | 10 | |
gvaquette | 0:0a75a79d6b77 | 11 | int main() { |
gvaquette | 1:7a8764e627b5 | 12 | e_test user_choice ; |
gvaquette | 0:0a75a79d6b77 | 13 | ft_print_test_menu(pc); |
gvaquette | 1:7a8764e627b5 | 14 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 15 | |
gvaquette | 4:bf5caf4c0c88 | 16 | |
gvaquette | 4:bf5caf4c0c88 | 17 | /* Main loop */ |
gvaquette | 1:7a8764e627b5 | 18 | while(1) |
gvaquette | 1:7a8764e627b5 | 19 | { |
gvaquette | 4:bf5caf4c0c88 | 20 | /* Which component to test ? */ |
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 | 9:19255172362f | 45 | //ft_print_cny_analog_voltage(cny_1, pc); |
gvaquette | 2:8153195b1672 | 46 | pc.printf("\t CNY_2"); |
gvaquette | 9:19255172362f | 47 | //ft_print_cny_analog_voltage(cny_2, pc); |
gvaquette | 2:8153195b1672 | 48 | pc.printf("\t CNY_3"); |
gvaquette | 9:19255172362f | 49 | //ft_print_cny_analog_voltage(cny_3, 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 | 8:c2d06715025f | 65 | ft_print_to_be_imp(pc); //TODO : Replace this line |
gvaquette | 3:a0e37b8918ac | 66 | user_choice = ft_get_user_choice(pc); |
gvaquette | 3:a0e37b8918ac | 67 | break; |
gvaquette | 3:a0e37b8918ac | 68 | |
gvaquette | 3:a0e37b8918ac | 69 | case RIGHT_MOTOR: |
gvaquette | 8:c2d06715025f | 70 | ft_print_to_be_imp(pc); //TODO : Replace this line |
gvaquette | 3:a0e37b8918ac | 71 | user_choice = ft_get_user_choice(pc); |
gvaquette | 3:a0e37b8918ac | 72 | break; |
gvaquette | 3:a0e37b8918ac | 73 | |
gvaquette | 2:8153195b1672 | 74 | |
gvaquette | 1:7a8764e627b5 | 75 | default : |
gvaquette | 1:7a8764e627b5 | 76 | ft_print_test_menu(pc); |
gvaquette | 1:7a8764e627b5 | 77 | user_choice = ft_get_user_choice(pc); |
gvaquette | 1:7a8764e627b5 | 78 | break; |
gvaquette | 1:7a8764e627b5 | 79 | } |
gvaquette | 1:7a8764e627b5 | 80 | } |
gvaquette | 1:7a8764e627b5 | 81 | |
gvaquette | 0:0a75a79d6b77 | 82 | } |