Arpan Das
/
CAN_Send_ra
Sending dummy message on CAN bus.
Revision 0:4097729a7390, committed 2013-04-25
- Comitter:
- ZeDarkLord
- Date:
- Thu Apr 25 05:45:48 2013 +0000
- Commit message:
- Sending messages on CAN...
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 4097729a7390 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 25 05:45:48 2013 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" + +Ticker ticker; +DigitalOut led1(LED1); +//DigitalOut led2(LED2); +//CAN can1(p9, p10); +CAN can2(p9, p10); +char counter = 0; + +void send() { + printf("send()\n"); + if(can2.write(CANMessage(1337, &counter, 1))) { + printf("wloop()\n"); + counter++; + printf("Message sent: %d\n", counter); + } + led1 = !led1; +} + +int main() { + printf("main()\n"); + ticker.attach(&send, 1); + /*CANMessage msg; + while(1) { + printf("loop()\n"); + if(can2.read(msg)) { + printf("Message received: %d\n", msg.data[0]); + led2 = !led2; + } + wait(0.2); + }*/ + wait(0.2); +}
diff -r 000000000000 -r 4097729a7390 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 25 05:45:48 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7e6c9f46b3bd \ No newline at end of file