当MAX30100库的pox.update()处于Arduino循环中时,我无法连接

当MAX30100库的pox.update()处于Arduino循环中时,我无法连接,arduino,arduino-c++,Arduino,Arduino C++,社区的朋友们好。我花了很多时间试图解决这个问题,我希望你能帮助我。 我使用这个链接中的库来实现我的项目。arduino代码执行得很好,但当我尝试从连接到HC-05的串行端口接收数据时,当循环中存在pox.update()时,我无法连接数据,接收到的数据如下所示: R o b e r t o A n d r e s 所以我需要将其取消,以便在128x64 oled显示屏上显示。此外,if(incomingByte=='T')条件似乎没有执行,因为oled显示屏没有显示getStringfro

社区的朋友们好。我花了很多时间试图解决这个问题,我希望你能帮助我。 我使用这个链接中的库来实现我的项目。arduino代码执行得很好,但当我尝试从连接到HC-05的串行端口接收数据时,当循环中存在pox.update()时,我无法连接数据,接收到的数据如下所示:

R
o
b
e
r
t
o
 
A
n
d
r
e
s
所以我需要将其取消,以便在128x64 oled显示屏上显示。此外,
if(incomingByte=='T')
条件似乎没有执行,因为oled显示屏没有显示
getStringfromProgMem(3)
char。循环代码为:

  void loop() {
  if (Serial.available() > 0) {
    incomingByte = Serial.read();
    if (incomingByte == 'T') {
      palabra = getStringfromProgMem(3);
      c = 0;
    } else {
      palabra.concat(incomingByte); 
    }
  }
  pox.update();
  display.clearDisplay();
  estado = digitalRead(STATE);
  estado ? (enlace()) : (noenlace());
  unsigned long tiempoActual = millis();
  if (tiempoActual - tiempoAnterior >= intervaloEvento) {
    rate = pox.getHeartRate();
    spo = pox.getSpO2();
    if (rate && palabra != getStringfromProgMem(3)) {
      c++;
    }
    if (c == 60) {
      c = 0;
    }
    /*Serial.print(rate);
    Serial.print(',');
    Serial.print(spo);
    Serial.print(',');
    Serial.println(c);*/
    tiempoAnterior = tiempoActual;
  }
  mostrar(rate, 15, 35);
  mostrar(spo, 105, 35);
  mostrar(getStringfromProgMem(0), 10, 52);
  mostrar(getStringfromProgMem(1), 100, 52);

  /*outputValue = (VERF * analogRead(ANALOG)) / 1024;
    smoothedVal = smoothedVal + ((outputValue - smoothedVal) / SAMPLES);
    comparacion(smoothedVal);*/
  //
  display.display();
}
该代码仅显示oled显示屏中的第一个字母,而忽略其他字母。我也在使用这个库:

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "MAX30100_PulseOximeter.h"
#include <avr/pgmspace.h>

代码
palabra.concat(incomingByte)
在没有“pox.update()”方法的情况下运行良好。我做错了什么?我想我解决了。问题是由于我的Arduino内存泄漏而产生的。当我试图连接字符串“palabra”时,Arduino根本没有这样做,因为内存泄漏。如果任何人在处理字符串时遇到问题,并且Arduino无法连接字符串,我建议访问以下网站:

现在我不知道如何处理c字符串,但这是时间的问题

你们中的任何人都知道如何清理
静态字符palabra[15],*pSdata=palabra

当我使用字符串时,就是简单地编写
palabra=“”。但是现在,我不知道怎么做。我希望你能帮助我

你好

char incomingByte;
String palabra="";