WorldFamousElectronics / PulseSensor_Amped_Arduino

PulseSensor Arduino code for BPM and Processing-Visualizer
MIT License
238 stars 206 forks source link

Arduino MKR1000 #16

Open beckmx opened 8 years ago

beckmx commented 8 years ago

Hello guys, I was testing the library, I noticed there is a compatibility issue with the timer interrupt 2, I was wondering if the timer can be replaced for something more general for other arduinos.

Greetings

biomurph commented 8 years ago

What is the target arduino that you are using? Check the Interrupt Notes tab for details about how to change the timer and ISR vector.

beckmx commented 8 years ago

Hello, I could make it work, actually is ok for all arduinos. What I did was to replace the ISR for a counter,

void loop(){ loopTmr(); delay(2); reps+=1; if(reps==10){ //execute serial output } }

The signal displays very good and smoothly, it could be considered as an alternative for other arduinos as well.

Greetings!

2016-03-08 9:35 GMT-06:00 Joel Murphy notifications@github.com:

What is the target arduino that you are using? Check the Interrupt Notes tab for details about how to change the timer and ISR vector.

— Reply to this email directly or view it on GitHub https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/issues/16#issuecomment-193826489 .

CarlosE473 commented 8 years ago

Could you please show the full replacement of the code? Or what is "loopTmr();"

beckmx commented 8 years ago

Look at the dependencies,there is a method called like that just look at the inside and fix according to my notes

On Wednesday, 23 March 2016, CarlosE473 notifications@github.com wrote:

Could you please show the full replacement of the code? Or what is "loopTmr();"

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/issues/16#issuecomment-200617092

rewant24 commented 7 years ago

@beckmx Hi, I looked at the dependencies and still couldn't figure it out. I was wondering if is it possible for you to kindly share your file? (newbie here, my apologies) I am using a mkr1000 as well and getting all the issues as everyone else with the interrupt timer. I have looked online (a lot of other people with the same problem couldn't resolve this issue either), and played around with the code, but nothing has worked for me so far. I just want to print the BPM values in serial monitor instead of the raw analog/ signal values! Is there an easy workaround for this problem?

biomurph commented 7 years ago

@beckmx As long as this 'software timer' solution works for you, that's great. But when you use delay(2); to do the timing, the system can be easily broken if you add in other delay or other operations. In my 'software timer', I use a couple of variables to monitor the passage of micros(). This is a more flexible solution. You can find the example code at the end of this document. https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/blob/master/PulseSensorAmped_Arduino_1.5.0/Timer_Interrupt_Notes.ino