on a project where i read my heat meter (kamstrup multical 601) via ir interface i need to invert tx in the SoftwareSerial lib
i got the cpp file and .h file in a new folder called SoftwareSerial_inv
but the .h file is the same as the normal SoftwareSerial... its only the cpp that has changed.
now i put them in a new folder so they did not mix up and i have also renamed the file name to end on _inv and my goal was to say: #include <SoftwareSerial_inv.h> in the sketch
what do i need to change inside the SoftwareSerial_inv.h file so it matches up with the cpp file?
yes it will either work or not... if it does not work i have the problem that i dont know how to get it to work...
but allready now i get errors:
sketch_jan02a:28: error: 'SoftwareSerial_inv' does not name a type
sketch_jan02a.ino: In function 'void setup()':
sketch_jan02a:41: error: 'kamSer' was not declared in this scope
sketch_jan02a.ino: In function 'void kamSend(const byte*, int)':
sketch_jan02a:143: error: 'kamSer' was not declared in this scope
sketch_jan02a.ino: In function 'short unsigned int kamReceive(byte*)':
sketch_jan02a:155: error: 'kamSer' was not declared in this scope
sketch attached.... i have an idea that kamSer pin definitions has to move down to the setyp void?
The name you use in that ifdef block could be anything. It doesn't have any special purpose to the compiler. All it is there for is to make sure the .h file doesn't get included twice. So the first time it gets included the ifndef is true and you define something. It could be anything. But the key is that if that library is included again in a sketch, by being included in a library or in another tab, then the compiler will see that thing has already been defined making the ifndef false so the compiler skips to the #endif and nothing gets included.
You could just as well use #ifndef BHYUGHTF #define BHYUGHTF
// your calss
#endif
But that might get confusing no? So we typically make it look something like the name of the file so we can know what it is referring to. But the fact that it resembles the file name or the class name is entirely for our human benefit. The compiler could care less what it spells or how many underscores you put in it.