-->
Page 1 of 3

"esp8266-01" tx for output

PostPosted: Sun Jan 22, 2017 8:05 am
by TarekJ
- is there a way to use tx and rx for outputs in "esp8266-01" ?
- could you provide a code ?

Re: "esp8266-01" tx for output

PostPosted: Sun Jan 22, 2017 9:00 am
by rudy
You did not say what language you are programming in. But yes you can. Just use D1 or D3 instead of say D4. Just make sure you disable the serial port function if it is enabled.

Re: "esp8266-01" tx for output

PostPosted: Sun Jan 22, 2017 9:14 am
by TarekJ
rudy wrote:You did not say what language you are programming in. But yes you can. Just use D1 or D3 instead of say D4. Just make sure you disable the serial port function if it is enabled.


I program it through Arduino IDE, I do not use lua
I did not understand what you mean by D1 or D3, please explain, can you mention a similar project or code?

Thanks

Re: "esp8266-01" tx for output

PostPosted: Sun Jan 22, 2017 10:33 am
by Barnabybear
Hi, have a look at the colourfull table about half way down this page
wiki/doku.php?id=esp8266_gpio_pin_allocations

By default the pins are as listed in the table function 0, pin 1 Tx and pin 3 Rx. You want pin 1 to be function 3 a GPIO.
You can activate any “FUNCTION” with pinMode(pin, FUNCTION1) for example.

Code: Select all// this will swap the pin to a GPIO
pinMode(1, FUNCTION3);

// this will restore the pin to Tx
pinMode(1, FUNCTION0);