program for receiving 2021NHK B_team controller

Dependencies:   2021Bcon

Committer:
piroro4560
Date:
Sat Oct 16 13:42:48 2021 +0000
Revision:
1:0cc19b454fc6
Parent:
0:157b6d43eb95

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
piroro4560 0:157b6d43eb95 1 #include "controller.h"
piroro4560 0:157b6d43eb95 2 #include "pinconfig.h"
piroro4560 0:157b6d43eb95 3
piroro4560 0:157b6d43eb95 4 Bcon mycon(fepTX, fepRX, fepad);
piroro4560 0:157b6d43eb95 5 Serial pc(pcTX, pcRX, 115200);
piroro4560 0:157b6d43eb95 6
piroro4560 0:157b6d43eb95 7 int main()
piroro4560 0:157b6d43eb95 8 {
piroro4560 0:157b6d43eb95 9 mycon.StartReceive();
piroro4560 0:157b6d43eb95 10 uint8_t b[8];
piroro4560 0:157b6d43eb95 11 int16_t stick[4];
piroro4560 0:157b6d43eb95 12 while(1) {
piroro4560 0:157b6d43eb95 13 for (int i=0; i<8; i++) b[i] = mycon.getButton(i);
piroro4560 0:157b6d43eb95 14 for (int i=0; i<4; i++) stick[i] = mycon.getStick(i);
piroro4560 0:157b6d43eb95 15
piroro4560 0:157b6d43eb95 16 for (int i=0; i<8; i++) pc.printf("%d ", b[i]);
piroro4560 0:157b6d43eb95 17 pc.printf(" | ");
piroro4560 0:157b6d43eb95 18 for (int i=0; i<4; i++) pc.printf("%3d ", stick[i]);
piroro4560 0:157b6d43eb95 19 pc.printf(" | ");
piroro4560 1:0cc19b454fc6 20 if (mycon.status) pc.printf("received\r\n");
piroro4560 1:0cc19b454fc6 21 else pc.printf("anything error...\r\n");
piroro4560 0:157b6d43eb95 22 }
piroro4560 0:157b6d43eb95 23 }