老 姚
/
CANBUSTest
CANBUS Test
Diff: main.cpp
- Revision:
- 0:6da715211ca6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 19 13:23:19 2018 +0000 @@ -0,0 +1,14 @@ +#include "mbed.h" + +DigitalOut myled(D8); +CAN can1(PD_0, PD_1,500000); +int main() { + CANMessage msg; + while(1) { + if(can1.read(msg)) { + printf("Message received:id=%d,type=%d,%d\n", msg.id,msg.type,msg.data[0]); + myled = !myled; + + } + } +}