sends on both can busses

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gabber
Date:
Tue Apr 30 05:47:18 2013 +0000
Commit message:
init

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 777a6becd0b5 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 30 05:47:18 2013 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+
+ Ticker ticker;
+ DigitalOut led1(LED1); // senden1 OK
+ DigitalOut led2(LED2); // senden2 OK
+ DigitalOut led3(LED3);
+ DigitalOut led4(LED4); // alive
+ CAN can1(p9, p10);
+ CAN can2(p30, p29);
+ Serial pc(USBTX, USBRX); // tx, rx
+ 
+ char counter = 0;
+
+ void send() {    
+    if(can1.write(CANMessage(1337, &counter, 1))) {
+        led1=1;
+        pc.printf("S:  Message sent: %d  Errors:%d \n\r", counter,can1.tderror());
+        counter++;
+     }
+     else{
+        led1 = 0;
+     }       
+     if(can2.write(CANMessage(1337, &counter, 1))) {
+        led2=1;
+        pc.printf("S:  Message sent: %d  Errors:%d \n\r", counter,can2.tderror());
+        counter++;
+     }
+     else{
+        led2 = 0;
+     }
+ }
+ 
+
+ int main() {
+     ticker.attach(&send, 2.0);
+     pc.printf("S: Hi!");    
+    can1.frequency(125000);
+    can2.frequency(125000);
+    
+     while(1) {
+        //canIN.reset();
+
+         wait(0.2);
+         led4 =!led4;
+     }
+ }
\ No newline at end of file
diff -r 000000000000 -r 777a6becd0b5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 30 05:47:18 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7e6c9f46b3bd
\ No newline at end of file