2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。
Dependencies: SBDBT arrc_mbed BNO055
library/function.hpp@9:569c0f55dd9b, 2022-02-03 (annotated)
- Committer:
- guesta
- Date:
- Thu Feb 03 13:07:37 2022 +0000
- Revision:
- 9:569c0f55dd9b
- Parent:
- 5:1a850f68a06c
- Child:
- 10:ad8fced7d6b6
add regulation;
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 | 9:569c0f55dd9b | 13 | bool l1; |
guesta | 3:6fb5c3218608 | 14 | |
guesta | 3:6fb5c3218608 | 15 | //スティックのx成分取得 |
guesta | 3:6fb5c3218608 | 16 | bool getLstick_x(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 17 | x_component = rx_data; |
guesta | 3:6fb5c3218608 | 18 | return true; |
guesta | 3:6fb5c3218608 | 19 | } |
guesta | 3:6fb5c3218608 | 20 | |
guesta | 3:6fb5c3218608 | 21 | //スティックのy成分取得 |
guesta | 3:6fb5c3218608 | 22 | bool getLstick_y(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 23 | y_component = rx_data; |
guesta | 3:6fb5c3218608 | 24 | return true; |
guesta | 3:6fb5c3218608 | 25 | } |
guesta | 3:6fb5c3218608 | 26 | |
guesta | 3:6fb5c3218608 | 27 | //L1取得 |
guesta | 3:6fb5c3218608 | 28 | bool getL2(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 29 | l2_num = rx_data; |
guesta | 3:6fb5c3218608 | 30 | return true; |
guesta | 3:6fb5c3218608 | 31 | } |
guesta | 3:6fb5c3218608 | 32 | |
guesta | 3:6fb5c3218608 | 33 | //R2取得 |
guesta | 3:6fb5c3218608 | 34 | bool getR2(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 35 | r2_num = rx_data; |
guesta | 3:6fb5c3218608 | 36 | return true; |
guesta | 3:6fb5c3218608 | 37 | } |
guesta | 3:6fb5c3218608 | 38 | |
guesta | 3:6fb5c3218608 | 39 | |
guesta | 3:6fb5c3218608 | 40 | //自動、手動モード切り替え |
guesta | 3:6fb5c3218608 | 41 | bool change_mode(int rx_data,int &tx_data){ |
guesta | 9:569c0f55dd9b | 42 | auto_mode = rx_data; |
guesta | 3:6fb5c3218608 | 43 | return true; |
guesta | 3:6fb5c3218608 | 44 | } |
guesta | 3:6fb5c3218608 | 45 | |
guesta | 5:1a850f68a06c | 46 | //上キー取得 |
guesta | 5:1a850f68a06c | 47 | bool getUp(int rx_data,int &tx_data){ |
guesta | 5:1a850f68a06c | 48 | up = rx_data; |
guesta | 5:1a850f68a06c | 49 | return true; |
guesta | 5:1a850f68a06c | 50 | } |
guesta | 3:6fb5c3218608 | 51 | |
guesta | 5:1a850f68a06c | 52 | //下キー取得 |
guesta | 5:1a850f68a06c | 53 | bool getDown(int rx_data,int &tx_data){ |
guesta | 5:1a850f68a06c | 54 | down = rx_data; |
guesta | 5:1a850f68a06c | 55 | return true; |
guesta | 5:1a850f68a06c | 56 | } |
guesta | 5:1a850f68a06c | 57 | |
guesta | 9:569c0f55dd9b | 58 | //L1取得 |
guesta | 9:569c0f55dd9b | 59 | bool getL1(int rx_data,int &tx_data){ |
guesta | 9:569c0f55dd9b | 60 | l1 = rx_data; |
guesta | 9:569c0f55dd9b | 61 | return true; |
guesta | 9:569c0f55dd9b | 62 | } |
guesta | 3:6fb5c3218608 | 63 | #endif |