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 #include "mbed.h" 00002 00003 CAN canObject(p30,p29); 00004 DigitalOut led1(LED1); 00005 DigitalOut led2(LED2); 00006 Serial pc(USBTX, USBRX); 00007 00008 void test(void) { 00009 led1= !led1; 00010 return; 00011 } 00012 00013 bool speed() { 00014 char can_msg[3]; 00015 can_msg[0] = 0x3D; 00016 can_msg[1] = 0x30; 00017 can_msg[2] = 0x00; 00018 00019 bool success = canObject.write(CANMessage(0x211, can_msg, 3)); 00020 led2 = !led2; 00021 return success; 00022 } 00023 00024 int main() 00025 { 00026 pc.baud(115200); 00027 wait(0.2); 00028 canObject.frequency(250000); 00029 wait(0.2); 00030 00031 canObject.attach(&test, CAN::RxIrq); 00032 00033 wait(1); 00034 if(speed()); 00035 wait(1); 00036 if(speed()); 00037 00038 while(1) { 00039 00040 } 00041 }
Generated on Sat Jul 16 2022 14:28:53 by
1.7.2