arduino due control ai motor's

Sorry Disturb everyone

Dear friends
My use arduino due I / O for TX0 & RX0
Here is my program

int led = 13;
int id;          // 馬達ID
int torg;        // 轉距(0:max, 4:min)
int checksum;    //  通訊協定
int tmp1, tmp2;  // byte  數量

void setup()
{
  pinMode(led,OUTPUT);
  Serial.begin(115200);  // 起始串列115200bps
  while(!Serial){        // 等待通訊
    ;
  }
  id = 0;
  torg = 2;  //  轉距速度
  
  digitalWrite(led,HIGH);
  tmp1 = (torg << 5) | id; //  馬達速度及編碼號
  tmp2 = 60;  // 位置碼
  checksum = (tmp1 ^ tmp2) & 0x7f; // 結束碼(馬達速度及編碼號XOR位置碼)
  Serial.write(0xff);   // 回傳編碼
  Serial.write(tmp1);
  Serial.write(tmp2); 
  Serial.write(checksum);
  delay(5000);   // 等待時間
}

void loop()
{
  digitalWrite(led,HIGH);
  tmp1 = (torg << 5) | id;   //馬達速度及編碼號
  tmp2 = 100;   //位置碼
  checksum = (tmp1 ^ tmp2) & 0x7f;  //結束碼(馬達速度及編碼號XOR位置碼)
  Serial.write(0xff);   //回傳編碼
  Serial.write(tmp1); 
  Serial.write(tmp2); 
  Serial.write(checksum);
  delay(1000); //等待時間
  
  digitalWrite(led,LOW);
  tmp1 = (torg << 5) | id;
  tmp2 = 200;
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff);
  Serial.write(tmp1); 
  Serial.write(tmp2); 
  Serial.write(checksum);
  delay(1000);
  
  digitalWrite(led,HIGH);
  tmp1 = (torg << 5) | id;
  tmp2 = 180;
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff); 
  Serial.write(tmp1); 
  Serial.write(tmp2); 
  Serial.write(checksum);
  delay(1000);
  
  digitalWrite(led,LOW);
  tmp1 = (torg << 5) | id;
  tmp2 = 220;
  checksum = (tmp1 ^ tmp2) & 0x7f;
  Serial.write(0xff);
  Serial.write(tmp1); 
  Serial.write(tmp2); 
  Serial.write(checksum);
  delay(1000);
}

Ai motor have four pins inside the motor (V, TX, RX, G)
Motor TX -> DUE RX0
Motor reception -> DUE TX0
AI motor it can control, but not control another one
How do I modify my program use to DUE another pin for TX1, RX1, TX2, RX2, RX3, TX3 (pin)
I have 4 AI motor control

How to do modify to control 4 ai motor and use all TX RX pin?

ypyp3399:
Ai motor have four pins inside the motor (V, TX, RX, G)
Motor TX -> DUE RX0
Motor reception -> DUE TX0
AI motor it can control, but not control another one
How do I modify my program use to DUE another pin for TX1, RX1, TX2, RX2, RX3, TX3 (pin)
I have 4 AI motor control

How to do modify to control 4 ai motor and use all TX RX pin?

By using the appropriate objects/methods for the other three serial ports, which are Serial1, Serial2 and Serial3... :wink:
As per reference of the Serial object:

The Arduino Due has three additional 3.3V TTL serial ports: Serial1 on pins 19 (RX) and 18 (TX); Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip, which is connected to the USB debug port. Additionally, there is a native USB-serial port on the SAM3X chip, SerialUSB'.