test

Dependencies:   mbed XBee

main.cpp

Committer:
kikuchi8810
Date:
2021-01-15
Revision:
1:cb2c4d733c1b
Parent:
0:0322e37424fa
Child:
2:cb2bd28bb66d

File content as of revision 1:cb2c4d733c1b:

#include "mbed.h"
#include "Controller.h"

Controller Con(p28,p27,115200);
Serial pc(USBTX,USBRX,115200);

int main()
{
    Con.DRbegin();
    while(1) {
        double joyRX = Con.readJoyRXbyte();
        double joyRY = Con.readJoyRYbyte();
        double joyLX = Con.readJoyLXbyte();
        double joyLY = Con.readJoyLYbyte();
        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);
    }
}