dualchock3_bluetooth_program
Dependencies: mbed SerialMultiByte
main.cpp@1:4975fece403d, 2020-10-14 (annotated)
- Committer:
- LVRhase01
- Date:
- Wed Oct 14 11:32:49 2020 +0000
- Revision:
- 1:4975fece403d
- Parent:
- 0:d4bfc5b1a113
- Child:
- 2:17b17437ad9e
- Child:
- 3:b2298d306097
can use dualchock3+arduinonano+bluetoothmodules
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
LVRhase01 | 0:d4bfc5b1a113 | 1 | #include "mbed.h" |
LVRhase01 | 0:d4bfc5b1a113 | 2 | #include "SerialMultiByte.h" |
LVRhase01 | 0:d4bfc5b1a113 | 3 | |
LVRhase01 | 0:d4bfc5b1a113 | 4 | Serial pc(USBTX, USBRX, 115200); |
LVRhase01 | 0:d4bfc5b1a113 | 5 | SerialMultiByte arduino(PC_12,PD_2); |
LVRhase01 | 0:d4bfc5b1a113 | 6 | |
LVRhase01 | 0:d4bfc5b1a113 | 7 | int main() |
LVRhase01 | 0:d4bfc5b1a113 | 8 | { |
LVRhase01 | 0:d4bfc5b1a113 | 9 | arduino.setHeaders(127,127); |
LVRhase01 | 1:4975fece403d | 10 | arduino.startReceive(8);// |
LVRhase01 | 1:4975fece403d | 11 | uint8_t deta[9]; |
LVRhase01 | 0:d4bfc5b1a113 | 12 | while(true) { |
LVRhase01 | 1:4975fece403d | 13 | arduino.getData(deta); |
LVRhase01 | 1:4975fece403d | 14 | for (uint8_t i = 0; i < 8; i++) { |
LVRhase01 | 1:4975fece403d | 15 | pc.printf("%d",deta[i]); |
LVRhase01 | 0:d4bfc5b1a113 | 16 | pc.printf("\t"); |
LVRhase01 | 0:d4bfc5b1a113 | 17 | } |
LVRhase01 | 0:d4bfc5b1a113 | 18 | pc.printf("\n"); |
LVRhase01 | 0:d4bfc5b1a113 | 19 | } |
LVRhase01 | 0:d4bfc5b1a113 | 20 | } |