Closed
Description
char hole[8] = {0x40, 0x00, 0x21, 0x01, 0x00, 0x00, 0x00, 0x00 };
CAN.MCP_CAN::sendMsgBuf(0x06000001, 1, 8, hole);
i send this to my keya motor..
i should get:
Motor current query: 40 00 21 01 00 00 00 00
Return ID: 0x0580000 + controller ID (hexadecimal)
Data 60 00 21 01 DATA 00 00 00
DATA =((unsigned char*)(&send_float))
but i do not receive anything...
with this:
unsigned char len = 0;
unsigned char buf[8];
if (CAN_MSGAVAIL == CAN.checkReceive()) { // check if data coming
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
unsigned long canId = CAN.getCanId();
SERIAL_PORT_MONITOR.println("-----------------------------");
SERIAL_PORT_MONITOR.print("Get data from ID: 0x");
SERIAL_PORT_MONITOR.println(canId, HEX);
for (int i = 0; i < len; i++) { // print the data
SERIAL_PORT_MONITOR.print(buf[i], HEX);
SERIAL_PORT_MONITOR.print("\t");
}
SERIAL_PORT_MONITOR.println();
Metadata
Metadata
Assignees
Type
Projects
Status
Done