-
Thank you very much for this example, d3nd3-o0. I have never seen inline C code in javascript before, so this is a bit of an education for me!
I will have a go with your example tomorrow because my attempt to implement the PineTime HRM graph app in javascript is not being very successful - I was assuming that the 'on hrm-raw' functions etc. were interrupt driven, but I was taking too long to draw the graph and blocking it, so need to be more careful.I see from the source code that there is another register that is supposed to adjust the LED current - but I find that if I try to set this, then the HRM stops updating after about 50 samples. I can see the LED intensity changing with register 0x17 as you suggested though.
But so far, I have not seen a stunning effect on the measured signal - will do some more digging tomorrow - thank you all for your suggestions!
This code can be used to view the data, might be useful. It is using analogRead from old method of reading pin directly instead of talk through i2c. Could be interesting to compare outputs. Pass hrm.raw into instead of val to c.onHRM to see difference. (You have to adjust graph constraints too, hrm.raw are huge numbers between 0 - 10000 ).
EDIT:
It is using wrong pin (29), its not hrm data