Go Down

Topic: library variables  (Read 36 times) previous topic - next topic


hi i am trying to make a library for the heart rate pulse sensor. this being my first library so excuse me if i don't know the obvious. but basically i am getting a compiler error that says  a variable is not declared yet i have it in both my header file and in my cpp where i convert it to a private variable. i think i am missing something obvious. how do i make this variable available to ISR?

all i am doing is taking the available pulse sensor example and trying to make a class so i can use multiple sensor on one arduino. any other advice in my first library is also welcome thank you  

my error message

C:\Users\Anastasia\Documents\Arduino\libraries\pulseM\pulseM.cpp: In function 'void __vector_7()':
C:\Users\Anastasia\Documents\Arduino\libraries\pulseM\pulseM.cpp:81:23: error: '_pulsePin' was not declared in this scope
   Signal = analogRead(_pulsePin);
Error compiling.


The ISR can't be part of the class, so it can't use any private variables.  It can't access any member variables or member functions unless they are static.  Interrupts and classes are a complicated mix. 
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131