MAX30105 code loop problem.

So I am using base code for SPO2 readings on the MAX30105 sensor on this link:

The full library that the above link is a part of is here:GitHub - sparkfun/MAX30105_Particle_Sensor_Breakout: Breakout to sense smoke, SpO2, Pulse Detection, as well as airborne particles.

The orginal code works fine: But the problem starts with modifications to line 103.When I try to replace the while(1) with a for loop or other conditional statement such as testing a number against a variable, e.g. while (var>5), the sensor no longer gives new readings. This is the case when the variable is a variable that is never changed and the condition is still always true. Because the base code is an infinite loop, I do not know how to use the same code with multiple sensors, because once the loop starts it never exits. And once I try and make the loop anything other than infinite, the sensor no longer gives new values. I am not sure If the loop is the problem, or because of the algorhithms or libraries used that the loop has to be infinite or something.

Welcome. Before you get too far along the wrong path. don't presume people are going to eagerly follow your links to search and download examples that may or not be what you're working with. If you want advise on your code, post it (in code tags). What time most of us will invest in helping will only be diluted if we are expected to chase around the net picking up snippets here and there.

coprez:
...I do not know how to use the same code with multiple sensors....

Looking at the datasheet I could not find how to change the address of the sensor to allow simultaneous use of more that one sensor.

How were you planning to connect your sensors to your arduino? I do not think connecting them onto the same bus would work... probably would need to multiplex them

just a thought...