-->
Page 1 of 1

Reading GPIO output pin

PostPosted: Sat Jan 31, 2015 1:18 am
by theater
HI guys,
I have an application for ESP8266 where I use two ways to change the state of GPIO - HTTP and MQTT. Because I'd like to know the status for better visualization I currently use global variable but it's very annoying that I need to make sure it's always updated where I change the state of the GPIO.
Do you think it's safe to read the state of this GPIO with function GPIO_INPUT_GET(PIN_GPIO) even though the pin is set to output? (in Arduino I know it's safe btw) :)
It would make life way more easy.

Thanks,
K.

Re: Reading GPIO output pin

PostPosted: Tue Feb 10, 2015 4:02 pm
by theater
No one with any idea? Please... :roll:

Re: Reading GPIO output pin

PostPosted: Tue Feb 10, 2015 5:39 pm
by Fr4gg0r
yes

Re: Reading GPIO output pin

PostPosted: Sat Feb 14, 2015 2:56 pm
by MK1888
Yes, you can read the state of an output in. The syntax depends on what you're programming in.

If you're using the NodeMCU firmware, check the wiki at https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en

If you're using AT commands you need the firmware that has GPIO support. I used it briefly, but moved on to the NodeMCU firmware with the LUA interpreter, and then to the Espressif SDK where you write your own firmware in C.