Hayato Kikuchi
/
XBee3-API_test
test
Diff: main.cpp
- Revision:
- 1:cb2c4d733c1b
- Parent:
- 0:0322e37424fa
- Child:
- 2:cb2bd28bb66d
--- a/main.cpp Fri Jan 15 08:07:48 2021 +0000 +++ b/main.cpp Fri Jan 15 08:50:35 2021 +0000 @@ -1,14 +1,9 @@ #include "mbed.h" -#include "DRBlue_controller.h" +#include "Controller.h" -DRBlue_controller Con(p28,p27,115200); +Controller Con(p28,p27,115200); Serial pc(USBTX,USBRX,115200); -void con_timer() -{ - Con.update(); -} - int main() { Con.DRbegin(); @@ -17,8 +12,10 @@ double joyRY = Con.readJoyRYbyte(); double joyLX = Con.readJoyLXbyte(); double joyLY = Con.readJoyLYbyte(); - pc.printf("%d\t",Con.getButtonState()); - pc.printf("%3.0lf %3.0lf %3.0lf %3.0lf\n",joyRX,joyRY,joyLX,joyLY); - wait(0.05); + unsigned int buttonstate = Con.getButtonState(); + if(buttonstate & BUTTON_MARU) pc.printf("%d\n",Con.getButtonState()); + else if(buttonstate & BUTTON_L2) pc.printf("%3.0lf %3.0lf %3.0lf %3.0lf\n",joyRX,joyRY,joyLX,joyLY); + else pc.printf("PUSH!\n"); + //wait(0.01); } }