CAN-SEND-HEX

Committer:
1038456
Date:
Fri Oct 07 08:13:39 2022 +0000
Revision:
0:34d79c8a92da
Child:
2:2ceffb6d9aa8
TUKAERUKAWAKARAN;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
1038456 0:34d79c8a92da 1 #include "CAN_SEND.hpp"
1038456 0:34d79c8a92da 2
1038456 0:34d79c8a92da 3 CANSend::CANSend(PinName RD,PinName TD) : can(RD,TD)
1038456 0:34d79c8a92da 4 {
1038456 0:34d79c8a92da 5 for(int i = 0;i < 3;i++){
1038456 0:34d79c8a92da 6 DATA[i] = 0;
1038456 0:34d79c8a92da 7 }
1038456 0:34d79c8a92da 8 }
1038456 0:34d79c8a92da 9
1038456 0:34d79c8a92da 10 void CANSend::SEND(int id, int data){
1038456 0:34d79c8a92da 11 DATA[0] = data % 100;//下2
1038456 0:34d79c8a92da 12 DATA[1] = data / 100;//上2
1038456 0:34d79c8a92da 13 CANMessage msg(id,DATA,2);
1038456 0:34d79c8a92da 14 can.write(msg);
1038456 0:34d79c8a92da 15 wait_ms(2);
1038456 0:34d79c8a92da 16 }