Go Down

Topic: Won't work as library (Read 387 times) previous topic - next topic

Delta_G

Hello,

This is my first post on this forum, I would appreciate any help you could give. 

I have a class that points one of a union of pointers at a variable from the program and updates it during an interrupt service routine.  I have to use the pointer because the ISR can take no arguments and I do not know until run-time which variable will be attached.  I am using a union because I don't know until run-time which type the variable will be. 

The code attached to this post works.  It works great for what I want on Arduino.  But when I put the header and program in separate files and make a library, it still compiles, but the variable doesn't get updated.  I have done some debugging and I know the ISR is being fired.  For some reason the pointer is not being dereferenced to my variable.  But again, if I copy out all the parts from .h and .cpp files and put them back into the sketch, things work fine.

I'm sure I'm missing an #include in this header or something. 
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

Delta_G

Written this way, all in one sketch, the program works.  I am not seeing any errors either way, only the number doesn't change.
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!

Arduino
via Egeo 16
Torino, 10131
Italy