12-17-2022 13:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-17-2022 13:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am trying to write an app where I need to keep reading from the heart rate sensor in real time, but I am having trouble with 2 things.
1. I can't seem to take the current hrm.heartRate and store it in a variable - it always comes back null. Is this a known issue?
2. It only runs through the sensors 1 time before stopping the app. How can I keep the sensors reading over and over again?
Thanks

12-17-2022 22:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-17-2022 22:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @rhysshadow - see heart-rate api
Stop it when the display goes off is good practice.
Check if your app may be crashing.
Author | ch, passion for improvement.

12-18-2022 08:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-18-2022 08:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am doing that, but I am still not getting anything from hrm.heartRate?
I need it to be constantly running, because I am doing something when the heart rate gets out of range. It's a strange idea, I know, but that's what I am trying anyway.
I'm going to be measuring against a timer of 5 minutes.
So every 5 minutes, I will measure the heartrate, and check it and then do something based on the heartRate I've saved from last time, and then the new heartRate.
But the question remains - can I save it into a variable to check against the new timer?

12-18-2022 10:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-18-2022 10:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@rhysshadow - your app stops running when the display is off and closes after 2 minutes of inactivity.
Author | ch, passion for improvement.

12-18-2022 11:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-18-2022 11:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Oh I get it now!
I figured out a timer aspect, so it doesn't start unless it's been 5 minutes now, and then shuts off after a minute. So I've got it working!
Thanks for the help!

