test

Dependencies:   mbed XBee

Committer:
kikuchi8810
Date:
Fri Jan 15 08:50:35 2021 +0000
Revision:
1:cb2c4d733c1b
Parent:
0:0322e37424fa
Child:
2:cb2bd28bb66d
ver.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kikuchi8810 0:0322e37424fa 1 #include "mbed.h"
kikuchi8810 1:cb2c4d733c1b 2 #include "Controller.h"
kikuchi8810 0:0322e37424fa 3
kikuchi8810 1:cb2c4d733c1b 4 Controller Con(p28,p27,115200);
kikuchi8810 0:0322e37424fa 5 Serial pc(USBTX,USBRX,115200);
kikuchi8810 0:0322e37424fa 6
kikuchi8810 0:0322e37424fa 7 int main()
kikuchi8810 0:0322e37424fa 8 {
kikuchi8810 0:0322e37424fa 9 Con.DRbegin();
kikuchi8810 0:0322e37424fa 10 while(1) {
kikuchi8810 0:0322e37424fa 11 double joyRX = Con.readJoyRXbyte();
kikuchi8810 0:0322e37424fa 12 double joyRY = Con.readJoyRYbyte();
kikuchi8810 0:0322e37424fa 13 double joyLX = Con.readJoyLXbyte();
kikuchi8810 0:0322e37424fa 14 double joyLY = Con.readJoyLYbyte();
kikuchi8810 1:cb2c4d733c1b 15 unsigned int buttonstate = Con.getButtonState();
kikuchi8810 1:cb2c4d733c1b 16 if(buttonstate & BUTTON_MARU) pc.printf("%d\n",Con.getButtonState());
kikuchi8810 1:cb2c4d733c1b 17 else if(buttonstate & BUTTON_L2) pc.printf("%3.0lf %3.0lf %3.0lf %3.0lf\n",joyRX,joyRY,joyLX,joyLY);
kikuchi8810 1:cb2c4d733c1b 18 else pc.printf("PUSH!\n");
kikuchi8810 1:cb2c4d733c1b 19 //wait(0.01);
kikuchi8810 0:0322e37424fa 20 }
kikuchi8810 0:0322e37424fa 21 }