Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CAN_LISTENER by
Revision 2:44a3c2680cbf, committed 2015-02-21
- Comitter:
- aasheesh
- Date:
- Sat Feb 21 18:18:10 2015 +0000
- Parent:
- 1:1e64adaf93da
- Commit message:
- Can Send;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Feb 19 15:36:28 2015 +0000 +++ b/main.cpp Sat Feb 21 18:18:10 2015 +0000 @@ -1,19 +1,22 @@ #include "mbed.h" -//-------------------------------------------------------------- -//CAN monitoring program for watching NXP LCP11C24 CAN messages -//Outputs to serial interface (Putty) -//02/19/2015 -//-------------------------------------------------------------- -CAN can(p9, p10); - + +Ticker ticker; +DigitalOut led1(LED1); +DigitalOut led2(LED2); +CAN can1(p9, p10); +char counter = 'U'; + +void send() { + can1.write(CANMessage(1337, &counter, 1)); + printf("Message sent: %d\n", counter); + led1 = !led1; +} + int main() { - int messagecount = 0; - printf("CAN Listener\n"); + printf("main()\n"); + can1.frequency(500000); CANMessage msg; while(1) { - if(can.read(msg)) { - printf("%d ----- Message received: %d\n", messagecount, msg.data[0]); - messagecount++; - } + send(); } -} \ No newline at end of file +}