Hi everybody,
I'm wokring on a project
logging onewire temperature-data to a SD-card avoiding tinkering around with loose parts through using ready-to-use components which are a teensy 4.1 and a wemos D1 mini.
Where I want to use a second serial interface on a teensy 4.1 and a ESP8266 WeMos D1 Mini to communicate with each other. For debugging purposes I additionally connect a USB CP2102 to listen to what the Teensy or the Wemos sends.
This means I have up to three serial monitors opened at the same time. To make it easier to distinguis which serial monitor is what I would like to write functions that can be used the exact same way as Serial.print() / Serial.println().
but that add info which serial interface is sending. Like "TeenSy3" "WeMosSoft"
Exact same way means I can put floats, integers and booleans, array of chars etc. into the brackets.
In standard-functions the variable-type of the parameters have to be defined.
So it only works for one variable-type.
print() and prrintln() can do them all. So there must be something different.
If I would have to write a heritaged class in a new library or something like that for realising this special version of print()/println() I stay away from it.
I want to emphasise: I don't expect what I write as follows:
except somebody would have fun to write, test and debug the whole thing until it is ready to use.
I decide either it is 20 lines of easy to understand code without knowing anything about classes in libraries
or I will take the route to use a construction assign everything to a global Debug_PString and then using two functions that do the printing to each serial-interface by calling this one function Myprint() / Myprintln()
If somebody posts a sketchy code that has to be adapted it would take approx. 50 hours of time to learn it from scratch how to adpat it. Then I decide to take the 2,5 hours to write the standard-functions. Even if this is more laborious, much less "elegant" and whatever.
It is a very conscious decision of mine to refuse to study and expand my programming-knowledge at this point.
So the first question is: Would I have to write a new class in a library to do so or will it be eaiser?
additional question: would have somebody have fun writing, testing, debugging it until ready to use?
best regards Stefan