FORARKADI

Dependencies:   mbed mypidror1 Motor Map

Committer:
drorbalbul
Date:
Fri Dec 27 17:50:14 2019 +0000
Revision:
0:d6eafce8e991
Child:
1:f0e37d1d1452
canrec for noam

Who changed what in which revision?

UserRevisionLine numberNew contents of line
drorbalbul 0:d6eafce8e991 1 #include "mbed.h"
drorbalbul 0:d6eafce8e991 2
drorbalbul 0:d6eafce8e991 3 DigitalOut led1(LED1);
drorbalbul 0:d6eafce8e991 4 CAN can1(PA_11, PA_12);
drorbalbul 0:d6eafce8e991 5
drorbalbul 0:d6eafce8e991 6 int main() {
drorbalbul 0:d6eafce8e991 7 printf("main()\n");
drorbalbul 0:d6eafce8e991 8 CANMessage msg;
drorbalbul 0:d6eafce8e991 9 while(1) {
drorbalbul 0:d6eafce8e991 10 if(can1.read(msg)) {
drorbalbul 0:d6eafce8e991 11 printf("got it\n\r");
drorbalbul 0:d6eafce8e991 12 printf("Message received: %d,,\n\r", msg.data[0]);
drorbalbul 0:d6eafce8e991 13 led1 = !led1;
drorbalbul 0:d6eafce8e991 14 }
drorbalbul 0:d6eafce8e991 15 wait(0.2);
drorbalbul 0:d6eafce8e991 16 }
drorbalbul 0:d6eafce8e991 17 }