Hola, me encuentro realizando un sensor de saturación de spo2 con el sensor MAX30100 de 7 pines, con su código solo me funciona perfectamente, pero si lo agrego al código de la pantalla TFT deja de sensarme, ya comprobé en parte de HARDWARE y no comparto ningún pin, la pantalla TFT solamente esta conectada a los 36 pines digitales de la parte inferior del Arduino Mega y el MAX30100 esta conectado a 3.3V, GND y a los pines de I2C SDA Y SCL, también me asegure de copiar todas las librerías pero sigue sin darme resultados, el código me empieza a funcionar cuando quito la parte de imprimir en la pantalla TFT, adjunto los tres códigos, el de SPO2, el de la pantalla TFT y el de los dos en conjunto.
Código de SPO2 Y TFT en conjunto
#include <UTFT.h>
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
PulseOximeter pox;
uint32_t tsLastReport = 0;
extern uint8_t BigFont[]; // Declaración de fuente de letra
UTFT myGLCD(CTE40,38,39,40,41); //CTE40 es para la pantalla ILI9486
void onBeatDetected()
{
Serial.println("Beat!");
}
void setup()
{
Serial.begin(115200);
Serial.print("Initializing pulse oximeter..");
if (!pox.begin()) {
Serial.println("FAILED");
for(;;);
} else {
Serial.println("SUCCESS");
}
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
pox.setOnBeatDetectedCallback(onBeatDetected);
myGLCD.InitLCD();
myGLCD.setFont(BigFont);
}
void loop()
{
texto();
// Make sure to call update as fast as possible
pox.update();
if (millis() - tsLastReport > REPORTING_PERIOD_MS)
{
Serial.print("Heart rate:");
Serial.print(pox.getHeartRate());
Serial.print("bpm / SpO2:");
Serial.print(pox.getSpO2());
Serial.println("%");
tsLastReport = millis();
}
}
void texto ()
{
int buf[478];
int x, x2;
int y, y2;
int r;
myGLCD.clrScr(); // Para limpiar toda la pantalla
myGLCD.fillScr(VGA_WHITE); // Color para el fondo
myGLCD.setColor(VGA_BLACK);
myGLCD.setBackColor(VGA_WHITE);
myGLCD.print("SPO2", LEFT, 100);
myGLCD.print(pox.getSpO2(),CENTER,100);
}
Código SPO2
Con este código el sensor MAX30100 funciona perfectamente
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
PulseOximeter pox;
uint32_t tsLastReport = 0;
void onBeatDetected()
{
Serial.println("Beat!");
}
void setup()
{
Serial.begin(115200);
Serial.print("Initializing pulse oximeter..");
// Initialize the PulseOximeter instance
// Failures are generally due to an improper I2C wiring, missing power supply
// or wrong target chip
if (!pox.begin()) {
Serial.println("FAILED");
for(;;);
} else {
Serial.println("SUCCESS");
}
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
// Register a callback for the beat detection
pox.setOnBeatDetectedCallback(onBeatDetected);
}
void loop()
{
// Make sure to call update as fast as possible
pox.update();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
Serial.print("Heart rate:");
Serial.print(pox.getHeartRate());
Serial.print("bpm / SpO2:");
Serial.print(pox.getSpO2());
Serial.println("%");
tsLastReport = millis();
}
}
Código Pantalla TFT
#include <UTFT.h>
extern uint8_t BigFont[]; // Declaración de fuente de letra
UTFT myGLCD(CTE40,38,39,40,41); //CTE40 es para la pantalla ILI9486
void setup()
{
// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(BigFont);
}
void loop()
{
int buf[478];
int x, x2;
int y, y2;
int r;
myGLCD.clrScr(); // Para limpiar toda la pantalla
myGLCD.fillScr(VGA_WHITE); // Color para el fondo
myGLCD.setColor(VGA_BLACK);
myGLCD.setBackColor(VGA_WHITE);
myGLCD.print("IMPRIMO EN PANTALLA", CENTER, 140);
}
Agradezco cualquier ayuda. muchas gracias.
