Pages: [1]   Go Down
Author Topic: Won't work as library  (Read 336 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 19
Posts: 785
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 

* QuickRotaryEncoder2_incomplete.zip (2.1 KB - downloaded 5 times.)
Logged

Offline Offline
God Member
*****
Karma: 19
Posts: 785
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Written this way, all in one sketch, the program works.  I am not seeing any errors either way, only the number doesn't change.

* add_long_char_3.pde (7.73 KB - downloaded 5 times.)
Logged

Pages: [1]   Go Up
Jump to: