![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
added serial up, down, left and right control
Dependencies: mbed
Fork of Robot_a_cables_v3_6 by
Diff: main.cpp
- Revision:
- 2:1e06fd49ea7b
- Parent:
- 1:4d70e593345f
- Child:
- 3:86e21a36eecb
diff -r 4d70e593345f -r 1e06fd49ea7b main.cpp --- a/main.cpp Wed Feb 28 11:34:52 2018 +0000 +++ b/main.cpp Fri Mar 02 10:05:55 2018 +0000 @@ -63,6 +63,7 @@ uint8_t state = 0; int data_rc; int data_report[100]; +bool dejafait = 0; CANMessage msg; pc.printf("CAN CONSOLE \r \n"); @@ -1126,23 +1127,29 @@ pc.printf("%c \r\n",c); wait(2); - send(identif, octet_send, RemoteData, length ); + + for(i = 0; i < 25; i++){ + if(dejafait == 0){ + send(identif, octet_send, RemoteData, length ); data_rc = 0; - for(i = 0; i < 50; i++){ + dejafait = 1; + } + pc.printf("Awaiting Data... \r\n"); if(can2.read(msg)) { - pc.printf("Message received: 0x%x \r\n", msg.data[data_rc]); - data_report[data_rc] = msg.data[data_rc]; - data_rc++; + pc.printf("Message received\r\n"); + pc.printf("Number of octet: %d \r\n", msg.len); + } }//end of for - for(i = 0; i < data_rc; i++){ - pc.printf("Data captured %d : 0x%x \r\n", data_rc, data_report[i]); + for(i = 0; i < msg.len; i++){ + pc.printf("Data captured %d : 0x%x \r\n", i, msg.data[i]); } data_rc = 0; + dejafait = 0; i = 0; state = 0; pc.printf("\r\n");