Max30100 y ubidots

Hola a todos de la comunidad

Tengo un problema que no se si me pudiesen apoyar , no logro comunicar el sensor max30100 con el envio de datos de ubidots , de alguna manera el programa se queda colgado y no sensa el modulo max30100 aqui adjunto el codigo , lo que quiero es poder enviar los datos de frecuencia cardiaca y concentracion de oxigeno a traves de wifi y recepcionarlo en ubidots

#include <Ubidots.h>
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"

const char* UBIDOTS_TOKEN = "BBFF-JjSWoGTaGCr0tj1Gjyk9hhHhLczUau"; // Put here your Ubidots TOKEN

const char* WIFI_SSID = "xxxxxxx"; // Put here your Wi-Fi SSID
const char* WIFI_PASS = "xxxxxxx"; // Put here your Wi-Fi password

Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);

#define REPORTING_PERIOD_MS 1000

PulseOximeter pox;
int BPM, SpO2;
int oro;
uint32_t tsLastReport = 0;

// Callback (registered below) fired when a pulse is detected
void onBeatDetected()
{
Serial.println("Beat!");

}

void setup()
{
oro= 0;
Serial.begin(115200);
ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);
Serial.print("Initializing pulse oximeter..");

if (!pox.begin()) {
    Serial.println("FAILED");
    for(;;);
} else {
    Serial.println("SUCCESS");
  
}

  pox.setOnBeatDetectedCallback(onBeatDetected);

}

void loop()
{

  // Make sure to call update as fast as possible
pox.update();
Serial.print("detecta");
BPM = pox.getHeartRate();
SpO2 = pox.getSpO2();
// Asynchronously dump heart rate and oxidation levels to the serial
// For both, a value of 0 means "invalid"
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    Serial.print("Heart rate:");
    Serial.print(BPM);
    Serial.print(" SpO2:");
    Serial.print(SpO2);
    Serial.print(" MILLIS:");
    Serial.print(millis());
     Serial.print("LASTREPORT:");
    Serial.print(tsLastReport);
    Serial.println(" %");
    tsLastReport = millis();
    }

ubidots.add("heart rate",BPM );// Change for your variable name
bool bufferSent = false;
bufferSent = ubidots.send(); // Will send data to a device label that matches the device

}

Moderador
No dejar claves ni SSID Editado por moderador

Por favor edita tu post y corrige el código de acuerdo a las Normas del Foro, punto 7.
Y si token, password y SSID son reales, te sugiero que, ya que editas, los borres.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.