Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SBDBT arrc_mbed
main.cpp
- Committer:
- guesta
- Date:
- 2022-01-21
- Revision:
- 3:e4b5563563af
- Parent:
- 1:642ee25ea489
- Child:
- 6:fd9b59f828e8
File content as of revision 3:e4b5563563af:
#include "mbed.h"
#include "scrp_slave.hpp"
#include "sbdbt.hpp"
int main(){
//---------------初期設定---------------
//scrp_slave
ScrpSlave scrp(PC_12,PD_2,PH_1,0x0807f800);
//sbdbt
sbdbt sb(A0,A1);
//scrp_slaveのid設定
const int wheel_num = 255;
const int BeanbagGet_num = 2;
const int BeanbagShot_num = 3;
const int TakoGetPut_num = 4;
//コマンド番号設定
const int x_component_cmd = 1;
const int y_component_cmd = 2;
const int l2_cmd = 3;
const int r2_cmd = 4;
const int select = 5;
//変数
int x_component;
int y_component;
int l2_num;
int r2_num;
//-------------------------------------
//スティックの返り値-128~127
while(true){
sb.button_state();
x_component = sb.lsx();
y_component = sb.lsy();
l2_num = sb.l2An();
r2_num = sb.r2An();
//printf("%d %d",x_component,y_component);
scrp.send1(wheel_num,x_component_cmd,x_component);
wait_ms(1);
scrp.send1(wheel_num,y_component_cmd,y_component);
wait_ms(1);
scrp.send1(wheel_num,l2_cmd,l2_num);
wait_ms(1);
scrp.send1(wheel_num,r2_cmd,r2_num);
wait_ms(1);
scrp.send1(wheel_num,select,sb.select());
wait_ms(1);
}
}