Hello everyone!! It’s my first time to create a new topic in here.
I have a project about controlling AK70-10 motor with Arduino UNO.
But I have no experience about using CAN communication & T motor before, I read the topics that created in forum.
With the code “Read_CAN_ID.ino” (below code), I found that my motor’s ID is “0x80002900”
#include <mcp_can.h>
#include <SPI.h>
MCP_CAN CAN(10); // Set CS pin with D10
void setup() {
Serial.begin(115200);
while (CAN.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) != CAN_OK) {
Serial.println("Error Initializing MCP2515...");
delay(1000);
}
CAN.setMode(MCP_NORMAL); // Set CAN mode as normal mode
Serial.println("CAN BUS Shield setting is ok!!!");
}
void loop() {
long unsigned int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
if (CAN.checkReceive() == CAN_MSGAVAIL) {
CAN.readMsgBuf(&rxId, &len, rxBuf); // Receive CAN Message
Serial.print("CAN ID: 0x");
Serial.println(rxId, HEX); // Print received CAN message into 16bit
Serial.print("Data: ");
for (int i = 0; i < len; i++) {
Serial.print(rxBuf[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}
After finding the CAN ID of T motor, I applied on the code that provided from Testing Cubemars AK60-6 motor using arduino.
I setup similar with the post, but it didn’t work… So can you guys help me with control the motor?
Hardware
Arduino UNO
Cubemars AK70-10 kv100 motor
MCP2515 CAN Bus with 8MHz
Software
MCP_CAN_lib in Arduino
After I debugging with cubemars upper software, I got result like this:
According to this, It says that the can ID is 1.
But my arduino code says 0x80002900… I’m really stuck on this… Please help me…