program for receiving 2021NHK B_team controller
Dependencies: 2021Bcon
main.cpp@0:157b6d43eb95, 2021-10-16 (annotated)
- Committer:
- piroro4560
- Date:
- Sat Oct 16 05:25:59 2021 +0000
- Revision:
- 0:157b6d43eb95
- Child:
- 1:0cc19b454fc6
test
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:157b6d43eb95 | 20 | if (mycon.status) pc.printf("OK\r\n"); |
piroro4560 | 0:157b6d43eb95 | 21 | else pc.printf("ERROR\r\n"); |
piroro4560 | 0:157b6d43eb95 | 22 | } |
piroro4560 | 0:157b6d43eb95 | 23 | } |