CM-530과 아두이노 우노 BT모듈을 사용한 UART통신

한국어 커뮤니티
CM-530과 아두이노 우노으로 BT410모듈을 통해 통신 패킷 데이터를 주고 받고 싶습니다.

통신 패킷 관련된 정보가 없어서 제가 만들어본 코드인데 확인부탁드립니다.
uint8_t TxD_packet_1[6] = {0xAA, 0x01, 0x0E, 0xAA, 0x00, 0x1E}; // U버튼 패킷
uint8_t TxD_packet_2[6] = {0xAA, 0x02, 0x7E, 0xAA, 0x00, 0x1E}; // D버튼 패킷
int packetToggle = 0; // 패킷 전송 토글

void setup() {
Serial.begin(57600); // 시리얼 통신 속도 설정
delay(2000); // 대기 시간
}

void loop() {
if (packetToggle == 0) {
Serial.write(TxD_packet_1, sizeof(TxD_packet_1)); // U버튼 패킷 전송
packetToggle = 1; // D버튼 패킷을 전송하기 위해 상태 변경
} else {
Serial.write(TxD_packet_2, sizeof(TxD_packet_2)); // D버튼 패킷 전송
packetToggle = 0; // U버튼 패킷을 전송하기 위해 상태 변경
}

// 디버깅 정보는 Serial 대신 Serial1이나 다른 시리얼 포트를 사용하거나 완전히 제거
// 필요시 주석 해제: Serial.flush(); // 전송 완료 대기

delay(3000); // 3초 대기
}

여기서 rc100리모컨의 u버튼과 d버튼을 누른 상태와 같은 신호를 보내는 것을 목표로 만든 코드인데, 통신패킷이 정확한지 궁금합니다.

The protocol for RC-100 packets is listed here

And it is possible to send RC-100 from the Arduino UNO to a CM-530 if you use only ROBOTIS BT hardware such as BT-410 Master and Peripheral, please visit this post:

Please read it and let me know if you need further help. This ino is for sending an RC100 packet to the CM-530.

Also under the Arduino DynamixelShield >> examples >> Basic there is a sketch named rc100.ino >> this one is for an Arduino board to receive an RC-100 packet

By the way, if you can afford to upgrade to UNO R4, I am highly recommending it as the UNO R4 has two Serial ports, you can keep one for the Serial Monitor and uses the other one for UART Comm. with the CM-530.

Please see this post.