This tests the CAN interface between two LISA C027 MBED Boards. By connecting the two boards, pins 1,2,3 respectively on the CAN interface, and loading and executing this code on BOTH boards, CAN messages will be received, and printed, on the PC-USB console interface of both devices.
Dependencies: C027-REVB UbloxUSBModem mbed
Fork of C027_ModemTransparentUSBCDC_revb by
Diff: main.cpp
- Revision:
- 3:048ec5c2dc14
- Parent:
- 2:c4ad86683060
diff -r c4ad86683060 -r 048ec5c2dc14 main.cpp --- a/main.cpp Sat Dec 14 00:24:59 2013 +0000 +++ b/main.cpp Sun Dec 15 21:35:12 2013 +0000 @@ -9,6 +9,8 @@ char counter = 0; +// this function creates a CAN message with a counter in it +// and sends it on the CAN interface void send() { if(can1.write(CANMessage(1337, &counter, 1))) { pc.printf("Message sent: %d\r\n", counter); @@ -25,6 +27,8 @@ // take it out of standby can_standby = 0; + // specify the baud rate for communications + // with the serial console to the PC host. pc.baud(MDMBAUD); pc.printf( "Starting CAN Testing\r\n"); @@ -39,6 +43,7 @@ wait(0.2); + // send a new message. send(); } }