Luis Silvio Cordova Rivadeneira
/
CAN_ex_1
CAN_ex_1
Revision 3:9d2d0b0189be, committed 2019-01-17
- Comitter:
- lscordovar
- Date:
- Thu Jan 17 22:05:53 2019 +0000
- Parent:
- 2:d6cbcdb04ada
- Commit message:
- Ejemplo CAN
Changed in this revision
diff -r d6cbcdb04ada -r 9d2d0b0189be main.cpp --- a/main.cpp Thu Oct 11 16:02:16 2018 +0000 +++ b/main.cpp Thu Jan 17 22:05:53 2019 +0000 @@ -1,15 +1,16 @@ #include "mbed.h" -#if defined (DEVICE_CAN) || defined(DOXYGEN_ONLY) +//#if defined (DEVICE_CAN) || defined(DOXYGEN_ONLY) Ticker ticker; -DigitalOut led1(LED1); -DigitalOut led2(LED2); +DigitalOut led1(PD_12); +DigitalOut led2(PD_14); /** The constructor takes in RX, and TX pin respectively. * These pins, for this example, are defined in mbed_app.json */ -CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD); -CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD); +CAN can1(PD_0, PD_1); +//CAN can2(PB_5, PB_6); + char counter = 0; void send() { @@ -28,15 +29,16 @@ CANMessage msg; while(1) { printf("loop()\n"); - if(can2.read(msg)) { + if(can1.read(msg)) { printf("Message received: %d\n", msg.data[0]); led2 = !led2; } wait(0.2); } } - +/* #else #error CAN NOT SUPPORTED #endif +*/ \ No newline at end of file
diff -r d6cbcdb04ada -r 9d2d0b0189be mbed-os.lib --- a/mbed-os.lib Thu Oct 11 16:02:16 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://github.com/ARMmbed/mbed-os/#34c1facf42a174f47fdf9002cd8c6bf10ac41744
diff -r d6cbcdb04ada -r 9d2d0b0189be mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jan 17 22:05:53 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479