Part of the Arduino function is as follows:
void sendDataThroughUART(void){
DataPacket[0] = ecgFilterout;
DataPacket[1] = ecgFilterout >> 8;
DataPacket[2] = resWaveBuff;
DataPacket[3] = resWaveBuff >> 8;
DataPacket[4] = globalRespirationRate;
DataPacket[5] = globalRespirationRate >> 8;
DataPacket[6] = globalHeartRate;
DataPacket[7] = globalHeartRate >> 8;
DataPacket[8] = 0;
//send packet header
for(int i=0; i<5; i++){
SerialBT.write(DataPacketHeader[i]);
}
//send 30003 data
for(int i=0; i<DATA_LEN; i++) // transmit the data
{
SerialBT.write(DataPacket[i]);
}
//send packet footer
for(int i=0; i<2; i++){
SerialBT.write(DataPacketFooter[i]);
}
}
void loop() {
if (SerialBT.connected()) {
ads1292OutputValues ecgRespirationValues;
boolean ret = ADS1292R.getAds1292EcgAndRespirationSamples(ADS1292_DRDY_PIN,ADS1292_CS_PIN,&ecgRespirationValues);
if (ret == true)
{
ecgWaveBuff = (int16_t)(ecgRespirationValues.sDaqVals[1] >> 8) ; // ignore the lower 8 bits out of 24bits
resWaveBuff = (int16_t)(ecgRespirationValues.sresultTempResp>>8) ;
SerialBT.printf("ECG: %d, Resp: %d\n", ecgWaveBuff, resWaveBuff); // 打印原始数据
if(ecgRespirationValues.leadoffDetected == false)
{
ECG_RESPIRATION_ALGORITHM.ECG_ProcessCurrSample(&ecgWaveBuff, &ecgFilterout); // filter out the line noise @40Hz cutoff 161 order
ECG_RESPIRATION_ALGORITHM.QRS_Algorithm_Interface(ecgFilterout,&globalHeartRate); // calculate
respFilterout = ECG_RESPIRATION_ALGORITHM.Resp_ProcessCurrSample(resWaveBuff);
ECG_RESPIRATION_ALGORITHM.RESP_Algorithm_Interface(respFilterout,&globalRespirationRate);
}else{
ecgFilterout = 0;
respFilterout = 0;
}
sendDataThroughUART();
}
}
}
In my serial port debugging, SerialBT.printf () displays normally, but in processing, no data is received. How can I debug this? I don’t know if it’s because of a problem with Bluetooth transmission or something else. I did not modify any transmission protocol, I just converted the serial port transmission to Bluetooth to see if it is feasible. Below is the serial port protocol connection.
I hope someone can provide debugging suggestions, thank you very much!