![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CAN a enviar_TLMoto
Fork of CANnucleo_Hello by
Diff: main.cpp
- Revision:
- 3:464b06c16d24
- Parent:
- 2:49c9430860d1
- Child:
- 4:ccf4ac2deac8
diff -r 49c9430860d1 -r 464b06c16d24 main.cpp --- a/main.cpp Thu Jul 23 13:11:08 2015 +0000 +++ b/main.cpp Fri Jul 24 00:46:47 2015 +0000 @@ -21,7 +21,7 @@ #include "mbed.h" #include "CAN.h" -#define BOARD1 1 // please change to 0 when compiling for board #2 +#define BOARD1 1 // please comment out this line when compiling for board #2 #if defined(BOARD1) #define RX_ID 0x100 @@ -32,6 +32,7 @@ #endif DigitalOut led(LED1); +int ledTarget; Timer timer; CAN can(PA_11, PA_12); // rx, tx CANMessage rxMsg; @@ -94,7 +95,8 @@ printf("\r\n"); if(rxMsg.id == RX_ID) { // if ID matches rxMsg >> counter; // extract first data item - rxMsg >> led; // extract second data item (and set LED status) + rxMsg >> ledTarget; // extract second data item + led = ledTarget; // set LED printf("counter = %d\r\n", counter); timer.start(); }