![](/media/cache/profiles/eb0fd39614866f36a18c701956dcd477.jpg.50x50_q85.jpg)
private
Diff: main.cpp
- Revision:
- 0:c322b3f3c22b
--- /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); +// } +//}