BASE
Dependencies: X-NUCLEO-IHM05A1
Diff: main.cpp
- Revision:
- 23:3110010d98a0
- Parent:
- 22:137d1ef8d22d
- Child:
- 24:37f139e067b2
diff -r 137d1ef8d22d -r 3110010d98a0 main.cpp --- a/main.cpp Sat Apr 06 09:29:05 2019 +0000 +++ b/main.cpp Sat Apr 06 14:51:15 2019 +0000 @@ -78,23 +78,23 @@ } // CAN -CAN can1(PA_11, PA_12); // RX, TX +CAN can1(PB_12, PB_13); // RX, TX CANMessage messageIn; CANMessage messageOut; -int filter = can1.filter(0x020, 0x4FF, CANStandard); +int filter = can1.filter(0x010, 0x4FF, CANStandard); void canrx() { while(1) { - if(can1.read(messageIn, filter)) + if(can1.read(messageIn,filter)&&messageIn.id==0x010) { pose=messageIn.data[0] + (messageIn.data[1] << 8) + (messageIn.data[2] << 16) + (messageIn.data[3] << 24); printf("CAN: mess %d\n\r", pose); - /* + if (pose == 1) { motor->run(StepperMotor::FWD); @@ -115,9 +115,9 @@ current_pose= motor->get_position(); motor->go_to(current_pose); } - */ + - motor->go_to(pose); + // motor->go_to(pose); } } }