2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。
Dependencies: SBDBT arrc_mbed BNO055
library/function.hpp@10:ad8fced7d6b6, 2022-03-11 (annotated)
- Committer:
- guesta
- Date:
- Fri Mar 11 04:24:27 2022 +0000
- Revision:
- 10:ad8fced7d6b6
- Parent:
- 9:569c0f55dd9b
- Child:
- 11:264f992664b0
NewVer;
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 | 10:ad8fced7d6b6 | 14 | bool auto_start; |
guesta | 3:6fb5c3218608 | 15 | |
guesta | 3:6fb5c3218608 | 16 | //スティックのx成分取得 |
guesta | 3:6fb5c3218608 | 17 | bool getLstick_x(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 18 | x_component = rx_data; |
guesta | 3:6fb5c3218608 | 19 | return true; |
guesta | 3:6fb5c3218608 | 20 | } |
guesta | 3:6fb5c3218608 | 21 | |
guesta | 3:6fb5c3218608 | 22 | //スティックのy成分取得 |
guesta | 3:6fb5c3218608 | 23 | bool getLstick_y(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 24 | y_component = rx_data; |
guesta | 3:6fb5c3218608 | 25 | return true; |
guesta | 3:6fb5c3218608 | 26 | } |
guesta | 3:6fb5c3218608 | 27 | |
guesta | 3:6fb5c3218608 | 28 | //L1取得 |
guesta | 3:6fb5c3218608 | 29 | bool getL2(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 30 | l2_num = rx_data; |
guesta | 3:6fb5c3218608 | 31 | return true; |
guesta | 3:6fb5c3218608 | 32 | } |
guesta | 3:6fb5c3218608 | 33 | |
guesta | 3:6fb5c3218608 | 34 | //R2取得 |
guesta | 3:6fb5c3218608 | 35 | bool getR2(int rx_data,int &tx_data){ |
guesta | 3:6fb5c3218608 | 36 | r2_num = rx_data; |
guesta | 3:6fb5c3218608 | 37 | return true; |
guesta | 3:6fb5c3218608 | 38 | } |
guesta | 3:6fb5c3218608 | 39 | |
guesta | 3:6fb5c3218608 | 40 | |
guesta | 3:6fb5c3218608 | 41 | //自動、手動モード切り替え |
guesta | 3:6fb5c3218608 | 42 | bool change_mode(int rx_data,int &tx_data){ |
guesta | 9:569c0f55dd9b | 43 | auto_mode = rx_data; |
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 | 9:569c0f55dd9b | 59 | //L1取得 |
guesta | 9:569c0f55dd9b | 60 | bool getL1(int rx_data,int &tx_data){ |
guesta | 9:569c0f55dd9b | 61 | l1 = rx_data; |
guesta | 9:569c0f55dd9b | 62 | return true; |
guesta | 9:569c0f55dd9b | 63 | } |
guesta | 10:ad8fced7d6b6 | 64 | |
guesta | 10:ad8fced7d6b6 | 65 | //auto_start取得 |
guesta | 10:ad8fced7d6b6 | 66 | bool getStart(int rx_data,int &tx_data){ |
guesta | 10:ad8fced7d6b6 | 67 | auto_start = rx_data; |
guesta | 10:ad8fced7d6b6 | 68 | return true; |
guesta | 10:ad8fced7d6b6 | 69 | } |
guesta | 3:6fb5c3218608 | 70 | #endif |