This one takes CAN data and spits it out over USB serial

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
melse
Date:
Wed Aug 07 15:31:41 2013 +0000
Commit message:
Initial Commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Aug 07 15:31:41 2013 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+
+CAN can(p9, p10);
+Serial pcSerial(USBTX, USBRX);
+DigitalOut led(LED1);
+
+int main() {
+    pcSerial.baud(9600);
+    CANMessage msg;
+    while(1) {
+        if (can.read(msg)) {
+            // Write the data to serial...
+            pcSerial.printf("Message received: %d\n", msg.data[0]);
+            led = !led;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Aug 07 15:31:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e3affc9e7238
\ No newline at end of file