2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。

Dependencies:   SBDBT arrc_mbed BNO055

library/function.hpp

Committer:
guesta
Date:
2022-01-21
Revision:
3:6fb5c3218608
Child:
5:1a850f68a06c

File content as of revision 3:6fb5c3218608:

#ifndef function_hpp
#define function_hpp
#include "mbed.h"

//変数
bool auto_mode = false;
int x_component;
int y_component;
int l2_num;
int r2_num;

//スティックのx成分取得
bool getLstick_x(int rx_data,int &tx_data){
    x_component = rx_data;
    return true;
}

//スティックのy成分取得
bool getLstick_y(int rx_data,int &tx_data){
    y_component = rx_data;
    return true;
}

//L1取得
bool getL2(int rx_data,int &tx_data){
     l2_num = rx_data;
     return true;
}

//R2取得
bool getR2(int rx_data,int &tx_data){
     r2_num = rx_data;
     return true;
}
     

//自動、手動モード切り替え
bool change_mode(int rx_data,int &tx_data){
    if(rx_data == 1){
        auto_mode =! auto_mode;
        while(auto_mode == 0);
    }
    return true;
}


#endif