FBR CAN bus testing program

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
intrinseca
Date:
Thu Jan 31 16:40:32 2013 +0000
Commit message:
Basic CAN testing program

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
diff -r 000000000000 -r ec1cf6fd7dea main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 31 16:40:32 2013 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+
+Ticker ticker;
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+CAN can1(p30, p29);
+char counter = 0;
+
+void send() {
+    if(can1.write(CANMessage(1337, &counter, 1))) {
+        led2 = !led2;
+    }
+    
+    led1 = !led1;
+}
+
+int main() {
+    ticker.attach(&send, 1);
+    CANMessage msg;
+    can1.frequency(250000);
+    
+    int i = 0;
+    
+    while(1) {
+        if(can1.read(msg)) {
+            counter++;
+            led3 = !led3;
+        }
+        
+        wait(0.2);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r ec1cf6fd7dea mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jan 31 16:40:32 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593
\ No newline at end of file