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.c
00001 #include <mbed.h> 00002 00003 Ticker ticker; 00004 DigitalOut led1(LED1); 00005 DigitalOut led2(LED2); 00006 CAN can1(PB_8, PB9_9); 00007 //CAN can2(p30, p29); 00008 char counter = 0; 00009 00010 void send() 00011 { 00012 printf("send()\n"); 00013 if(can1.write(CANMessage(1337, &counter, 1))) { 00014 printf("wloop()\n"); 00015 counter++; 00016 printf("Message sent: %d\n", counter); 00017 } 00018 led1 = !led1; 00019 } 00020 00021 int main() 00022 { 00023 printf("main()\n"); 00024 ticker.attach(&send, 1); 00025 CANMessage msg; 00026 while(1) { 00027 printf("loop()\n"); 00028 if(can1.read(msg)) { 00029 printf("Message received: %d\n", msg.data[0]); 00030 led2 = !led2; 00031 } 00032 wait(0.2); 00033 } 00034 }
Generated on Sun Nov 20 2022 00:34:09 by
1.7.2