2022_gorobo_Ateam
/
Reset_Botton
遠隔でのリセットが可能
main.cpp
- Committer:
- kazumayamanaka
- Date:
- 2022-04-04
- Revision:
- 0:310f7f58a9e9
File content as of revision 0:310f7f58a9e9:
#include "mbed.h" #include "scrp_slave.hpp" int number=0; ScrpSlave slave(PC_12,PD_2,PH_1,SERIAL_TX,SERIAL_RX,5); bool mode = 0; bool play1(int rx_data,int &tx_data){ if(rx_data==1)number++; return true; } bool play2(int rx_data,int &tx_data){ if(rx_data==2)mode=1; else mode=0; return true; } void reset(void){ printf("reset\n"); NVIC_SystemReset(); } int main(void){ slave.addCMD(1,play1); slave.addCMD(2,play2); while(1){ printf("%d\n",number); if(mode==1)reset(); wait(0.05); } }