Invzblio / SerialToWifi

Drop-in replacement for the Serial Arduino library that outputs results to a remote server over wifi
Creative Commons Zero v1.0 Universal
15 stars 3 forks source link

hardware serial pin available ? #3

Closed Skywalkerf34 closed 2 years ago

Skywalkerf34 commented 2 years ago

Hi Pascal,

Thanks for this library, I compile example then port to my program with ESP32 C3 chip and to work like a charm Next question is does it give me the two pin (RxTx) free for other purpose ?

Happy new year

Invzblio commented 2 years ago

Happy new year to you too!

There is a way you can use both SerialToWifi AND the standard Serial library. You will loose the ability to easilly switch from one to the other though. You first need to redefine the Serial class right after the library declaration by using

define Serial Serial

This might generate a compilation warning, simply ignore it

Then, in order to use the SerialToWifi library, use the serialToWifi class instead of Serial like serialToWifi.begin(115200); serialToWifi.println("starting wifi");

in parallel, you'll still be able to use tx/rx pins through the Serial commands. I attached a sample .ino file demonstrating this.

Hope this helps!

Pascal

swifi.zip

Skywalkerf34 commented 2 years ago

Hi Pascal,

thanks for this prompt reply to help I didn't explain correctly my need : What I want is to use those GPIO for other purpose than serial because I already use all for my design except those RxTx pins as I am using those for debug/tracing but not for production (this is kind of IOT project)

Rgds

Francis

Invzblio commented 2 years ago

Hi Francis, I wouldn't recommend going that route as decribed in this reddit post: https://www.reddit.com/r/esp32/comments/qdo2cv/can_i_use_rx_and_tx_as_gpio/

If you absolutely can't do otherwise, test it and see if it works with your exact situation. Hope this helps!

Pascal

Skywalkerf34 commented 2 years ago

@Invzblio Thanks for the recommendation, but I have already done that for other projects before the only problem is the is some signal going out Tx at boot for very few seconds before running Firmware, so have to be careful and not use this Tx pin for launching a Rocket ;-)

Invzblio commented 2 years ago

So I guess that answers your initial question! The pins are free as long as you don't comment out the SerialToWifi.h include statement.