MAX30100 Oximeter and RF transmitter 433 MHz to Arduino Nano

Why MAX30100 oximeter does not measure when I added the code of RF transmitter?

Here is the code

//the Arduino Nano 2 will be used to continuously check if the oxygen
//threshold is exceeded or not knowing that the normal oxygen level is
//more than 88% and whether the bracelet pushbutton is pressed or not
//to send a signal equals 1 to Arduino UNO

#include <RH_ASK.h> // Include RadioHead Amplitude Shift Keying Library
#include <SPI.h> // Include dependant SPI Library and it is not actually used but needed for compilation
// Include Libraries needed for oximeter
#include <Wire.h>
#include “MAX30100_PulseOximeter.h”
#define REPORTING_PERIOD_MS 10

PulseOximeter pox;
uint32_t tsLastReport = 0;
RH_ASK rf_driver;

// Callback (registered below) fired when a pulse is detected
void onBeatDetected()
{
Serial.println(“Beat!”);
}
int x=3;
int pushbutton=7;// Bracelet pushbutton is connected to digital pin 3
int RF1_trans=12;// RF transmitter_1 is connected to digital pin 12
//int Sda=4; Clock data pin is connected to digital pin 4
//int Scl=5; Clock input pin is connected to digital pin 5
//int Int=2; Interrupt pin is connected to digital pin 2
int Y[4]={0,0,0}; // Array to use three readings to ensure that the threshold is exceeded

void setup()
{

Serial.begin(9600);
pinMode(pushbutton,INPUT_PULLUP);// Declare pushbutton as input_pullup
pinMode(RF1_trans,OUTPUT);// RF1_trans as output
pinMode(3,OUTPUT);
// Initialize the oximeter and check if it works properly
Serial.print(“Initializing pulse oximeter…”);
if (!pox.begin()) {

    Serial.println("FAILED");

    for(;;);

} else {

    Serial.println("SUCCESS");

}

// Register a callback for the beat detection

pox.setOnBeatDetectedCallback(onBeatDetected);

// Initialize ASK Object

rf_driver.init();

}

void loop()
{

// To reduce error, array Y is used to store three values and then
//compare them with a certain threshold to take an action accordingly
pox.update();
for (int j=0; j<3;j++)
{

if (millis() - tsLastReport > REPORTING_PERIOD_MS) {

   Serial.print(" SpO2:");
   Serial.print(pox.getSpO2());
   Serial.println("%");
   tsLastReport = millis();
   Y[j]=(pox.getSpO2()); 
   Serial.println(j); 
   Serial.println(":"); 
   Serial.println(Y[j]); 
   
}
delay(100);

}

int Push_button;
Push_button=digitalRead(pushbutton);// read pushbutton value

// Check if the stored values exceeded the threshold (88%) 
//or the pushbutton is pressed to transmit "One" to Arduino Uno 

//delay(50);
if ((Y[0]<88 && Y[1]<88 && Y[2]<88)|| Push_button==1)
{
const char *msg = “One”;
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
delay (1000);
{
// Message Transmitted
Serial.println("Message Transmitted: ");
}
}
}

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