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 Ticker ticker; 00004 DigitalOut statusLED(LED1); 00005 DigitalOut CANrcvd(LED2); 00006 CAN radar(p30,p29); 00007 Serial pc(USBTX, USBRX); // tx, rx 00008 00009 void status_callback(){ 00010 statusLED = !statusLED; 00011 } 00012 00013 int main() { 00014 00015 statusLED = 1; 00016 CANrcvd = 0; 00017 ticker.attach(&status_callback, 0.1); 00018 pc.printf("Starting. Please work!"); 00019 00020 CANMessage msg; 00021 while(1) { 00022 if(radar.read(msg)) { 00023 pc.printf("Message received: %d\n", msg.id); 00024 CANrcvd = !CANrcvd; 00025 } 00026 wait(0.2); 00027 } 00028 }
Generated on Fri Aug 12 2022 17:59:18 by
1.7.2