T Nara
/
CAN
CAN transmitter
Revision 0:18ab097e5fd9, committed 2018-11-12
- Comitter:
- tknara
- Date:
- Mon Nov 12 13:21:47 2018 +0000
- Commit message:
- CAN transmitter
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 18ab097e5fd9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Nov 12 13:21:47 2018 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +Ticker ticker; +DigitalOut led1(LED1); +CAN can1(PA_11,PA_12); +char counter = 0; + +void send() { + printf("send()\n"); + if(can1.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, 0.5); + CANMessage msg; + while(1) { + printf("loop()\n"); + wait(0.2); + } +} \ No newline at end of file
diff -r 000000000000 -r 18ab097e5fd9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Nov 12 13:21:47 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file