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.
main.cpp
00001 /* Program Example 13.5: CAN data read – reads CAN messages from the CAN bus 00002 */ 00003 #include "mbed.h" 00004 Serial pc(USBTX, USBRX); // tx, rx for Tera Term output 00005 DigitalOut led2(LED2); // status LED 00006 CAN can1(p9, p10); // CAN interface 00007 int main() { 00008 CANMessage msg; // create empty CAN message 00009 printf("read...\n"); 00010 while(1) { 00011 if(can1.read(msg)) { // if message is available, read into msg 00012 printf("Message received: %d\n", msg.data[0]); // display message data 00013 led2 = !led2; // toggle status LED 00014 } 00015 } 00016 } 00017
Generated on Fri Jul 29 2022 08:59:24 by
1.7.2