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 Robot_a_cables_v1_0 by
Revision 0:1ab5fdb4fa56, committed 2018-02-09
- Comitter:
- LouisReynier
- Date:
- Fri Feb 09 20:49:17 2018 +0000
- Child:
- 1:4d70e593345f
- Commit message:
- Programme qui g?n?re la trame qui est sens?e faire passer le noeud 20 dans une autre dimension !; Test?e ? l'analyseur logique : ca marche !
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 Fri Feb 09 20:49:17 2018 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+ // LR 9/02/18
+ //
+ // bus CAN
+ //
+ // Ce programme genere une trame
+ // id=00, data= 01 20 , longueur = 2, can standard (11 bits id)
+ //
+ // testé à l'analyseur logique = OK !!
+
+Ticker ticker;
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+CAN can1(p9, p10,1000000);// on definit pin et debit
+CAN can2(p30, p29, 1000000);
+char counter = 0;
+char octet_emis[8] = "ABCD";
+int id = 0x539 ;
+
+void send() {
+
+ printf("send()\n");
+ id = 0x00 ;
+ octet_emis[0] = 0x01 ;
+ octet_emis[1] = 0x20 ;
+ if(can1.write(CANMessage(id, octet_emis, 2, CANData, CANStandard ))) {
+ printf("wloop()\n");
+ counter++;
+ printf("Message sent: %d\n", counter);
+ }
+ led1 = !led1;
+}
+
+int main() {
+
+ printf("main()\n");
+ ticker.attach(&send, 1);
+ CANMessage msg;
+ while(1) {
+ printf("loop()\n");
+ if(can2.read(msg)) {
+ printf("Message received: %d\n", msg.data[0]);
+ led2 = !led2;
+ }
+ wait(0.2);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 09 20:49:17 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file
