Demo mode
Dependencies: BioroboticsMotorControl mbed
main.cpp@1:1e67c5a527cc, 2018-11-01 (annotated)
- Committer:
- MAHCSnijders
- Date:
- Thu Nov 01 11:25:58 2018 +0000
- Revision:
- 1:1e67c5a527cc
- Parent:
- 0:91a5bdab07d3
Demo mode
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MAHCSnijders | 0:91a5bdab07d3 | 1 | #include "mbed.h" |
MAHCSnijders | 0:91a5bdab07d3 | 2 | #include "motor.h" |
MAHCSnijders | 0:91a5bdab07d3 | 3 | #include "Screen.h" |
MAHCSnijders | 0:91a5bdab07d3 | 4 | |
MAHCSnijders | 0:91a5bdab07d3 | 5 | InterruptIn Button1(D2); // Right button on interface |
MAHCSnijders | 0:91a5bdab07d3 | 6 | InterruptIn Button2(D3); // Left button on interface |
MAHCSnijders | 0:91a5bdab07d3 | 7 | InterruptIn Panic_button(D8); // Red button on interface |
MAHCSnijders | 0:91a5bdab07d3 | 8 | Screen screen(D14, D15, D9); // Screen interface |
MAHCSnijders | 0:91a5bdab07d3 | 9 | Motor main_motor(D6, D7, D13, D12); |
MAHCSnijders | 0:91a5bdab07d3 | 10 | Motor sec_motor(D5, D4, D10, D11); |
MAHCSnijders | 0:91a5bdab07d3 | 11 | |
MAHCSnijders | 1:1e67c5a527cc | 12 | void () |
MAHCSnijders | 1:1e67c5a527cc | 13 | |
MAHCSnijders | 1:1e67c5a527cc | 14 | |
MAHCSnijders | 1:1e67c5a527cc | 15 | |
MAHCSnijders | 0:91a5bdab07d3 | 16 | int main() |
MAHCSnijders | 0:91a5bdab07d3 | 17 | { |
MAHCSnijders | 0:91a5bdab07d3 | 18 | while (true) |
MAHCSnijders | 0:91a5bdab07d3 | 19 | { |
MAHCSnijders | 0:91a5bdab07d3 | 20 | screen.clear_display(); |
MAHCSnijders | 0:91a5bdab07d3 | 21 | screen.display_state_name("Demo mode"); |
MAHCSnijders | 0:91a5bdab07d3 | 22 | |
MAHCSnijders | 0:91a5bdab07d3 | 23 | control_goes_up = true; |
MAHCSnijders | 0:91a5bdab07d3 | 24 | control_goes_right = true; |
MAHCSnijders | 0:91a5bdab07d3 | 25 | |
MAHCSnijders | 0:91a5bdab07d3 | 26 | screen.display_up_down_arrow(control_goes_up); |
MAHCSnijders | 0:91a5bdab07d3 | 27 | screen.display_left_right_arrow(control_goes_right); |
MAHCSnijders | 0:91a5bdab07d3 | 28 | screen.display(); |
MAHCSnijders | 1:1e67c5a527cc | 29 | |
MAHCSnijders | 1:1e67c5a527cc | 30 | Button1.fall(); |
MAHCSnijders | 1:1e67c5a527cc | 31 | Button2.fall(); |
MAHCSnijders | 1:1e67c5a527cc | 32 | |
MAHCSnijders | 1:1e67c5a527cc | 33 | if (p_button.is_pressed()) { // For panic state |
MAHCSnijders | 1:1e67c5a527cc | 34 | current_state = failure;} |
MAHCSnijders | 1:1e67c5a527cc | 35 | |
MAHCSnijders | 1:1e67c5a527cc | 36 | |
MAHCSnijders | 0:91a5bdab07d3 | 37 | } |
MAHCSnijders | 0:91a5bdab07d3 | 38 | } |