i have build a test sketch for a 'menu control' for debugging things..
this sketch is reachable in two ways:
Telnet (arduino ethernet)
the Telnet thing is based on the concept of this post
for windows you can use PuTTY a telnet client.
at the moment i need a extra menu handler function for both communication ways.
but i would like to use the same menu handler function.
so i had two ideas to get this to work:
(1) give the handler function a pointer to the Object it should use for print
(2) have a 'own' myprint function that prints to both outputs.
(just calls the orig. Serial.print() and EthernetClient.print() with the same content)
so with version (2) i would need a function that imitates the orig. print function -
but thats not so trivial - because i think there are multiple versions to get the different data-types printed -
so if i am right i would have to build that behavior too (minimal for the types i use..)
for (1) i think it should be really easy - but i don't know which pointer type to use-
one time i could use HardwareSerial the other i need EthernetClient - so how to get this together?
i know that they are both based on Stream and for printing Stream is based on Print ??
so if someone of you have an idea how to do this pleas let me know !
i have added a demosketch with the simple Serial and Telnet Menus.
(edit: updated title and updated the sketch attachment)
test_MultiOut.ino (25.5 KB)