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.
Diff: main.cpp
- Revision:
- 0:6a28949eda55
diff -r 000000000000 -r 6a28949eda55 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Nov 12 13:23:15 2018 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+Serial serial(PA_9,PA_10);
+DigitalOut myled(PB_3);
+CAN can(PA_11,PA_12);
+char counter = 0;
+CANMessage msg;
+void callback(){
+ if(can.read(msg)){
+ serial.printf("Message received: ID:%d,data0:%d,data1:%d\n",msg.id,msg.data[0],msg.data[1]);
+ }
+}
+int main() {
+ can.attach(&callback, CAN::RxIrq);
+ while(1)
+ {
+ serial.printf("loop()\n");
+ wait(0.5);
+ }
+}