Open Aj12384 opened 4 years ago
Hi, Aj12384.
Did you mean this?
for i in range(37):
print(hrcalc.calc_hr_and_spo2(ir[25*i:25*i+100], red[25*i:25*i+100]))
If so, the code is for getting HR/SpO2 by sliding 1 samples at an iteration. For example, the top 3 output lines correspond to
(-999, False, -999, False) # <- using ir[25:125], red[25:125]
(107, True, 99.43662599999999, True) # <- using ir[26:126], red[26:126]
(88, True, 99.519096, True) # <- using ir[27:127], red[27:127]
As you can see, the output values fluctuate. You may need to get average for more robust result.
If not, I could not get your question. Could you add some information?
No I mean that in the hrcalc, whenever I run the code, I do not seem so be getting any output. The code just runs.
You cannot see the output of hrcalc.calc_hr_and_spo2()
in your environment, right?
Then, what happens if you use a variable, such as:
output_value = hrcalc.calc_hr_and_spo2(ir[:100], red[:100])
and print that value: print(output_value)
.
It’s working but I’m just getting the same values over and over again. How do I get the actual bpm and spo2?
Hi again, can you tell me how to display the actual BPM and SPO2 for the actual hrcalc.py? The code just runs and nothing happens... is there a variable I should define?
Hi, I just added two comments on github.
On Tue, Apr 7, 2020 at 11:52 PM vrano notifications@github.com wrote:
You cannot see the output of hrcalc.calc_hr_and_spo2() in your environment, right?
Then, what happens if you use a variable, such as: output_value = hrcalc.calc_hr_and_spo2(ir[:100], red[:100]) and print that value: print(output_value).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vrano714/max30102-tutorial-raspberrypi/issues/4#issuecomment-610737211, or unsubscribe https://github.com/notifications/unsubscribe-auth/APDCXN7EUPXKLCNZYV7VBUTRLPYJJANCNFSM4MDNL67A .
Okay, please tell me what you did and what you got in detail. Paste your code or screenshot.
Here is what I did.
I want to be able to get the actual reading from the sensor continously
When I try to use this code, it runs but nothing else happens
Actually, read_sequential
does read values (to the amount given as argument), but it does not run continuously (the method name may be confusing, sorry).
If we want to read continuously, we have to run read_sequential
many times.
Could you try the code below?
import max30102
import hrcalc
m = max30102.MAX30102()
for i in range(20): # try 20 times
red, ir = m.read_sequential() # if nothing is passed, this reads 100 values
print(hrcalc.calc_hr_and_spo2(ir, red))
I hope this works...
Hi, What do you mean after loading red and ir for the hrcalc code given in the readme?