I have a lib file "PSConstants.h" and in this file is PS_P_RADIUS defined:
#ifndef PS_P_RADIUS
#define PS_P_RADIUS 45
#endif
how can i change this Var in my pde file?
Like this?
#define PS_P_RADIUS 45
i have test it but nothing changes
I have a lib file "PSConstants.h" and in this file is PS_P_RADIUS defined:
#ifndef PS_P_RADIUS
#define PS_P_RADIUS 45
#endif
how can i change this Var in my pde file?
Like this?
#define PS_P_RADIUS 45
i have test it but nothing changes
Just change it in the PS Constants file.
so for every new pde wich uses this lib i must change it in the libfile?
If the library is installed correctly the same file can be #included in any program that requires it so it only needs to be changed once.
Yes but when i use this lib in many different *.INO files and i need in every file other parameters how can i change the PS_P_RADIUS parameter in every ino file?
If PS_P_RADIUS is defined in PSConstants.h and PSConstants.h is #included in a .INO file then the .INO file will use the value of PS_P_RADIUS from PSConstants.h. Do not define it in the .INO file
How can i Change it from the INO File?
If that value may need to be changed for different sketches then it should be a variable with a method to change it. It might even be worthwhile to require this value when being instanced. There's many ways to approach this. The best approach may depend on how the lib is coded. You might want to post the library.
If you want a different value in a particular .INO file then just define it there. Much to my surprise the compiler doesn't complain and the value defined in the .INO file is used in the program, at least it was when I tested it, but I don't know if this is guaranteed to work under all circumstances.
The compiler doesn't even complain if you do this.
#define myDefine 456
#define myDefine 789
It is probably a good idea to do this:
#undef PS_P_RADIUS
#define PS_P_RADIUS 42
So you know which value is being used.
Note, this only applies in your code, not any other files that #include the .h file.
Excellent advice