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.
Dependencies: mbed
Fork of CAN_SENDER by
main.cpp@2:44a3c2680cbf, 2015-02-21 (annotated)
- Committer:
- aasheesh
- Date:
- Sat Feb 21 18:18:10 2015 +0000
- Revision:
- 2:44a3c2680cbf
- Parent:
- 1:1e64adaf93da
Can Send;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rrbeauch | 0:b638c214ca06 | 1 | #include "mbed.h" |
aasheesh | 2:44a3c2680cbf | 2 | |
aasheesh | 2:44a3c2680cbf | 3 | Ticker ticker; |
aasheesh | 2:44a3c2680cbf | 4 | DigitalOut led1(LED1); |
aasheesh | 2:44a3c2680cbf | 5 | DigitalOut led2(LED2); |
aasheesh | 2:44a3c2680cbf | 6 | CAN can1(p9, p10); |
aasheesh | 2:44a3c2680cbf | 7 | char counter = 'U'; |
aasheesh | 2:44a3c2680cbf | 8 | |
aasheesh | 2:44a3c2680cbf | 9 | void send() { |
aasheesh | 2:44a3c2680cbf | 10 | can1.write(CANMessage(1337, &counter, 1)); |
aasheesh | 2:44a3c2680cbf | 11 | printf("Message sent: %d\n", counter); |
aasheesh | 2:44a3c2680cbf | 12 | led1 = !led1; |
aasheesh | 2:44a3c2680cbf | 13 | } |
aasheesh | 2:44a3c2680cbf | 14 | |
rrbeauch | 0:b638c214ca06 | 15 | int main() { |
aasheesh | 2:44a3c2680cbf | 16 | printf("main()\n"); |
aasheesh | 2:44a3c2680cbf | 17 | can1.frequency(500000); |
rrbeauch | 0:b638c214ca06 | 18 | CANMessage msg; |
rrbeauch | 0:b638c214ca06 | 19 | while(1) { |
aasheesh | 2:44a3c2680cbf | 20 | send(); |
rrbeauch | 0:b638c214ca06 | 21 | } |
aasheesh | 2:44a3c2680cbf | 22 | } |