I need my RX and TX pins back, and I'm using wifi. I want to create a library that overrides the print function so I can do something like log.print("I want to show up on the internet"); Behind the scenes, I want to connect to the server, post the data then disconnect.
Printing everything into a buffer of some kind then uploading after a log.upload(); command might be a good idea... Then you can do funky combos of .print and .println without reconnecting to the server every time.
Can someone show me an example of how to accomplish this? I am not great with C
Can someone show me an example of how to accomplish this? I am not great with C
You'll need to get great with C in order to do what you have stated, the way you have stated.
Serial and EthernetClient both derive from the Stream class which derives from Print. So, all the printing stuff is inherited from the Print class.
Creating a new class that inherits from EthernetClient would be the first step. You'd need to implement the two write() methods, which are the heart of the communications process, having them write to the buffer.
You'll need to be creative about how you implement the upload() method, since you can't use write() or any print() variation.
You could, alternatively, leave write() alone, and not use print(). Create your own overloaded set of methods to use in place of the print() methods.