Transferring Hatire plugin, Serial to Serial1

Hi,

I need help transferring data to the Hatire Plugin from serial to serial1(on Mega 2560, connecting to RX1 and TX1) via a Bluetooth HC-05 module. The data seem to be transmitting via the Bluetooth module, since no USB cable were connected to the Mega2560. (Quite honestly, I am not sure what is been transmitted)

//MinIMU9AHRS Tab
//Variable declaration/assignment
typedef struct {
int16_t Begin ; // 2 Debut
uint16_t Cpt ; // 2 Compteur trame or Code
float gyro[3]; // 12 [Y, P, R] gyro
float acc[3]; // 12 [x, y, z] Acc
int16_t End ; // 2 Fin
} hat;
_hat hat;

void setup()
{
..
// header frame...
hat.Begin=0xAAAA;
// Frame Number or Error code
hat.Cpt=0;
// footer frame hat.
End=0x5555;
}


//Placed in the Output tab portion
//This is the portion where I would like to send to serial1
void printdata(void)
{
hat.gyro[0] = ToDeg(roll);
hat.gyro[1] = ToDeg(pitch);
hat.gyro[2] = ToDeg(yaw);

// Send Trame to HATIRE PC
Serial.write((byte*)&hat,30);

// inc frame cpt
    hat.Cpt++;
if (hat.Cpt>1000) {
    hat.Cpt=0;;

}
}

Kindly see the the following link from the original creator/Coder
https://sourceforge.net/p/facetracknoir/discussion/iht/thread/eced1cb2/?limit=25&page=2#2368

Regards and thanks

MinIMU9AHRS.ino (7.28 KB)

Output.ino (3.01 KB)

Please post your complete program and describe the problems that you are having.

Hi UKHeliBob,

I figured out what the problem was. It is not the code. It the HC-05 Protocal. Change the baulrate to 115200,1,0 (1 stop bits) from 115200,0,0 solved the communication issue. And as for the serial output line, Serial.write((byte*)&hat,30); for RX,TX and Serial1.write((byte*)&hat,30); RX1/TX1. Tested and confirmed working.