老 姚
/
CANBUSTest
CANBUS Test
Revision 0:6da715211ca6, committed 2018-04-19
- Comitter:
- yao6116601
- Date:
- Thu Apr 19 13:23:19 2018 +0000
- Commit message:
- modular2 CANBUS testing
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 6da715211ca6 main.cpp --- /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; + + } + } +}
diff -r 000000000000 -r 6da715211ca6 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 19 13:23:19 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file