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.
Revision 0:ad0e7b06ff45, committed 2009-12-14
- Comitter:
- rolf
- Date:
- Mon Dec 14 12:11:26 2009 +0000
- Commit message:
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 ad0e7b06ff45 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Dec 14 12:11:26 2009 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led4(LED4);
+CAN can1(p9, p10);
+CAN can2(p30, p29);
+
+int main() {
+ char count = 0;
+ CANMessage msg;
+
+ while(1) {
+ if(can1.write(CANMessage(0x42, &count, 1))) {
+ led1 = 1;
+ }
+
+ if(can2.read(msg)) {
+ if(count == msg.data[0]) {
+ led2 = !led2;
+ count++;
+ }
+ }
+
+ wait(0.2);
+ led1 = led2 = 0;
+ led4 = !led4;
+ }
+}
+
+/*
+ ___ (NXP TJA 1050)
+ ____+---|| ||---+ mbed TJA1 TJA2
+ | |: |_v_| :|____ ----------------------
+ GND |: m = w :| | VV Vcc Vcc
+ | |: --- :| VV(5.0V) GND GND GND
+ | |: I O I :| | p9 RXD -
+ | +-=|: --- :| | p10 TXD -
+ | | ||: +-----+ :|=-+ | p29 - TXD
+ | | ||: | | :|| | | p30 - RXD
+ | | ||: | | :|| | | - CANL CANL
+ | | ||: +-----+ :|| | | - CANH CANH
+ | | ||: = = = = :|| | |
+ _____ | | |+-----------+| | |
+ |/TJA |-|-+ | | | |
++--|/1050|-|---|-------------|-|-+
+| +|/ |-+ | | | |
+| ||/____|-|---+ | | |
+| | _____ | | | |
+| ||/TJA |-|-----------------+ | |
++-||/1050|-|-------------------|-+
+ +|/ |-+ |
+ |/____|---------------------+
+ ^-- rounded side
+*/
diff -r 000000000000 -r ad0e7b06ff45 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 14 12:11:26 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0