Sameera Nawarathne
/
Kamal_CAN
private
Revision 0:c322b3f3c22b, committed 2017-01-27
- Comitter:
- sameera0824
- Date:
- Fri Jan 27 11:55:15 2017 +0000
- Commit message:
- CAN start
Changed in this revision
diff -r 000000000000 -r c322b3f3c22b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jan 27 11:55:15 2017 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" +#include "CAN3.h" + +//SPI spi(p11,p12,p13);// mosi, miso, sclk +SPI spi(p5,p6,p7);// mosi, miso, sclk +CAN3 can(spi,p9,p11); //spi, ncs, itr +DigitalOut led2(LED2); +DigitalOut led1(LED1); +Serial pc(USBTX, USBRX); + + char red[1] = {0}; + +int main() { + char data[1] = {0}; + can.frequency(500000); + CANMessage msg(2002,data,1); + //CANMessage msg(2002,stmp,1); + msg.data[0] = 123; + while(1) { + can.write(&msg); + pc.printf("Send:%d\r\n",msg.data[0]); + //led1 = !led1; + //wait(0.5); + // red = can.read(); + // pc.printf("Resive:%d\r\n",msg.data[0]); + } +} +// int main() { +// char data[1] = {0}; +// can.frequency(125000); +// CANMessage msg(2002,data,1); +// msg.data[0] = 253; +// while(1) { +// can.write(&msg); +// pc.printf("Send:%d\r\n",msg.data[0]); +// led1 = !led1; +// wait(0.5); +// } +//}
diff -r 000000000000 -r c322b3f3c22b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jan 27 11:55:15 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file
diff -r 000000000000 -r c322b3f3c22b mcp2515.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mcp2515.lib Fri Jan 27 11:55:15 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/tecnosys/code/mcp2515/#872137b3a8a8