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:0a01a8b970fc, committed 2014-03-19
- Comitter:
- alexliao1995
- Date:
- Wed Mar 19 20:38:33 2014 +0000
- Commit message:
- Test for CAN Interrupt;
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 19 20:38:33 2014 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+
+CAN canObject(p30,p29);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+Serial pc(USBTX, USBRX);
+
+void test(void) {
+ led1= !led1;
+ return;
+}
+
+bool speed() {
+ char can_msg[3];
+ can_msg[0] = 0x3D;
+ can_msg[1] = 0x30;
+ can_msg[2] = 0x00;
+
+ bool success = canObject.write(CANMessage(0x211, can_msg, 3));
+ led2 = !led2;
+ return success;
+}
+
+int main()
+{
+ pc.baud(115200);
+ wait(0.2);
+ canObject.frequency(250000);
+ wait(0.2);
+
+ canObject.attach(&test, CAN::RxIrq);
+
+ wait(1);
+ if(speed());
+ wait(1);
+ if(speed());
+
+ while(1) {
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 19 20:38:33 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079 \ No newline at end of file