Sending dummy message on CAN bus.

Dependencies:   TextLCD USBDevice mbed

Fork of CAN_Send_ra by Arpan Das

Files at this revision

API Documentation at this revision

Comitter:
tusharbhanarkar
Date:
Sun Jun 11 09:33:33 2017 +0000
Parent:
0:4097729a7390
Commit message:
can send tx

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sun Jun 11 09:33:33 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Sun Jun 11 09:33:33 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#01321bd6ff89
--- a/main.cpp	Thu Apr 25 05:45:48 2013 +0000
+++ b/main.cpp	Sun Jun 11 09:33:33 2017 +0000
@@ -1,18 +1,23 @@
 #include "mbed.h"
+#include "TextLCD.h"
+
+TextLCD lcd(p15,p16,p17,p18,p19,p20); // rs, e, d4,d5,d6,d7
  
 Ticker ticker;
 DigitalOut led1(LED1);
-//DigitalOut led2(LED2);
-//CAN can1(p9, p10);
+DigitalOut led2(LED2);
+CAN can1(p30,p29);
 CAN can2(p9, p10);
 char counter = 0;
  
 void send() {
     printf("send()\n");
     if(can2.write(CANMessage(1337, &counter, 1))) {
-        printf("wloop()\n");
+        //lcd.locate(0,0);
+        //lcd.printf("wloop()\n");
         counter++;
-        printf("Message sent: %d\n", counter);
+        lcd.locate(0,0);
+        lcd.printf("Message sent: %d\n", counter);
     } 
     led1 = !led1;
 }
@@ -20,14 +25,15 @@
 int main() {
     printf("main()\n");
     ticker.attach(&send, 1);
-    /*CANMessage msg;
+    CANMessage msg;
     while(1) {
         printf("loop()\n");
-        if(can2.read(msg)) {
-            printf("Message received: %d\n", msg.data[0]);
+        if(can1.read(msg)) {
+            lcd.locate(0,1);
+            lcd.printf("Message received: %d\n", msg.data[0]);
             led2 = !led2;
         } 
         wait(0.2);
-    }*/
-    wait(0.2);
+    }
+    //wait(0.2);
 }