by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Revision 0:b9b71a68570e, committed 2013-06-16
- Comitter:
- robt
- Date:
- Sun Jun 16 15:40:00 2013 +0000
- Commit message:
- by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r b9b71a68570e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jun 16 15:40:00 2013 +0000 @@ -0,0 +1,17 @@ +/* Program Example 13.5: CAN data read – reads CAN messages from the CAN bus + */ +#include "mbed.h" +Serial pc(USBTX, USBRX); // tx, rx for Tera Term output +DigitalOut led2(LED2); // status LED +CAN can1(p9, p10); // CAN interface +int main() { + CANMessage msg; // create empty CAN message + printf("read...\n"); + while(1) { + if(can1.read(msg)) { // if message is available, read into msg + printf("Message received: %d\n", msg.data[0]); // display message data + led2 = !led2; // toggle status LED + } + } +} +
diff -r 000000000000 -r b9b71a68570e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jun 16 15:40:00 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file