Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CANnucleo mbed ppCANOpen
Revision 3:464b06c16d24, committed 2015-07-24
- Comitter:
- hudakz
- Date:
- Fri Jul 24 00:46:47 2015 +0000
- Parent:
- 2:49c9430860d1
- Child:
- 4:ccf4ac2deac8
- Commit message:
- bug in setting LED status fixed
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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();
}