oxullo/Arduino-MAX30100

When call pox.update() in the loop, Arduino don't read Serial data from RX pin

Closed this issue · 7 comments

  • I read the README (on master) thoroughly
  • I ran the MAX30100_Tester and I'm going to paste the output down below
  • I filled in all the details of my setup down below

Hello friends of the community. I facing this error a quite long time and I hope you can help me.

When I call the pox.update() method into loop, the Arduino don't receive the entire data from Serial port, who it's connected to a HC-05 bluetooth module. But when I comment it, Arduino receive the data quite well. The variable "palabra" store the data from Serial.

The data of my sensor from the Tester example:

Initializing MAX30100..Success
Enabling HR/SPO2 mode..done.
Configuring LEDs biases to 50mA..done.
Lowering the current to 7.6mA..done.
Shutting down..done.
Resuming normal operation..done.
Sampling die temperature..done, temp=34.75C
All test pass.

Press any key to go into sampling loop mode

My setup:

  • Arduino hardware: Arduino Pro mini ATMega328P 5V 16MHz
  • MAX30100 breakout: RCWL-0530
  • Arduino framework version: 1.8.13
  • MAX30100 library version: 1.2.1

My Arduino code:

void loop() {
  if (Serial.available() > 0) {
    char incomingByte = Serial.read();
    if (incomingByte == 'T') {
      palabra = getStringfromProgMem(3);
      c = 0;
    } else {
      palabra += incomingByte;
    }
  }
  
  display.clearDisplay();
  pox.update();
  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);

  display.display();

  estado = digitalRead(STATE);
}

hi,
how can you solve this problem and please share me your logic because of this issue i also stuck in my project but i am using MAX30100 sensor instade of HC-05 .
please help me

@robertomaster Hi, would you mind sharing a copy of your code with me too? I am having the same issue. Thank you in advance.

Tesis.zip
Hi, I'm sended you a mail with the code. But I attach the ZIP file with my logic.

Greetings.

I solved this problem with this lines in the loop.

if (millis() - tsLastReport1 >= 75) {
tsLastReport1 = millis();
pox.update();
}