2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。
Dependencies: SBDBT arrc_mbed BNO055
library/function.hpp@5:1a850f68a06c, 2022-01-23 (annotated)
- Committer:
- guesta
- Date:
- Sun Jan 23 13:31:36 2022 +0000
- Revision:
- 5:1a850f68a06c
- Parent:
- 3:6fb5c3218608
- Child:
- 9:569c0f55dd9b
add go to target_position;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
guesta | 3:6fb5c3218608 | 1 | #ifndef function_hpp |
guesta | 3:6fb5c3218608 | 2 | #define function_hpp |
guesta | 3:6fb5c3218608 | 3 | #include "mbed.h" |
guesta | 3:6fb5c3218608 | 4 | |
guesta | 3:6fb5c3218608 | 5 | //変数 |
guesta | 3:6fb5c3218608 | 6 | bool auto_mode = false; |
guesta | 3:6fb5c3218608 | 7 | int x_component; |
guesta | 3:6fb5c3218608 | 8 | int y_component; |
guesta | 3:6fb5c3218608 | 9 | int l2_num; |
guesta | 3:6fb5c3218608 | 10 | int r2_num; |
guesta | 5:1a850f68a06c | 11 | bool up; |
guesta | 5:1a850f68a06c | 12 | bool down; |
guesta | 3:6fb5c3218608 | 13 | |
guesta | 3:6fb5c3218608 | 14 | //スティックのx成分取得 |
guesta | 3:6fb5c3218608 | 15 | bool getLstick_x(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 16 | x_component = rx_data; |
guesta | 3:6fb5c3218608 | 17 | return true; |
guesta | 3:6fb5c3218608 | 18 | } |
guesta | 3:6fb5c3218608 | 19 | |
guesta | 3:6fb5c3218608 | 20 | //スティックのy成分取得 |
guesta | 3:6fb5c3218608 | 21 | bool getLstick_y(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 22 | y_component = rx_data; |
guesta | 3:6fb5c3218608 | 23 | return true; |
guesta | 3:6fb5c3218608 | 24 | } |
guesta | 3:6fb5c3218608 | 25 | |
guesta | 3:6fb5c3218608 | 26 | //L1取得 |
guesta | 3:6fb5c3218608 | 27 | bool getL2(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 28 | l2_num = rx_data; |
guesta | 3:6fb5c3218608 | 29 | return true; |
guesta | 3:6fb5c3218608 | 30 | } |
guesta | 3:6fb5c3218608 | 31 | |
guesta | 3:6fb5c3218608 | 32 | //R2取得 |
guesta | 3:6fb5c3218608 | 33 | bool getR2(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 34 | r2_num = rx_data; |
guesta | 3:6fb5c3218608 | 35 | return true; |
guesta | 3:6fb5c3218608 | 36 | } |
guesta | 3:6fb5c3218608 | 37 | |
guesta | 3:6fb5c3218608 | 38 | |
guesta | 3:6fb5c3218608 | 39 | //自動、手動モード切り替え |
guesta | 3:6fb5c3218608 | 40 | bool change_mode(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 41 | if(rx_data == 1){ |
guesta | 3:6fb5c3218608 | 42 | auto_mode =! auto_mode; |
guesta | 3:6fb5c3218608 | 43 | } |
guesta | 3:6fb5c3218608 | 44 | return true; |
guesta | 3:6fb5c3218608 | 45 | } |
guesta | 3:6fb5c3218608 | 46 | |
guesta | 5:1a850f68a06c | 47 | //上キー取得 |
guesta | 5:1a850f68a06c | 48 | bool getUp(int rx_data,int &tx_data){ |
guesta | 5:1a850f68a06c | 49 | up = rx_data; |
guesta | 5:1a850f68a06c | 50 | return true; |
guesta | 5:1a850f68a06c | 51 | } |
guesta | 3:6fb5c3218608 | 52 | |
guesta | 5:1a850f68a06c | 53 | //下キー取得 |
guesta | 5:1a850f68a06c | 54 | bool getDown(int rx_data,int &tx_data){ |
guesta | 5:1a850f68a06c | 55 | down = rx_data; |
guesta | 5:1a850f68a06c | 56 | return true; |
guesta | 5:1a850f68a06c | 57 | } |
guesta | 5:1a850f68a06c | 58 | |
guesta | 5:1a850f68a06c | 59 | //四角キー取得 |
guesta | 5:1a850f68a06c | 60 | |
guesta | 5:1a850f68a06c | 61 | //三角キー取得 |
guesta | 5:1a850f68a06c | 62 | |
guesta | 5:1a850f68a06c | 63 | //丸キー取得 |
guesta | 5:1a850f68a06c | 64 | |
guesta | 5:1a850f68a06c | 65 | //Xキー取得 |
guesta | 3:6fb5c3218608 | 66 | #endif |