-->
Page 1 of 1

Configuring 10 pins as Digital Outputs

PostPosted: Tue Feb 07, 2017 6:07 pm
by joshbg2k
I'm working on a device that requires control of 10 components, which I'm trying to do by configuring 10 GPIO pins on a NodeMCU board. For now we are using the NodeMCU just as a serial device; we send serial data from a desktop app, and the Node MCU responds but setting the various IO pins to HIGH. I think I'm almost there. I've had trouble reconfiguring both TX and RX pins and getting both to work at the same time, so for now I've ignored the RX pins and set up my TX pins by setting the pin mode like this, according to the [url="http://www.esp8266.com/wiki/doku.php?id=esp8266_gpio_pin_allocations"]pin function chart[/url]:

Code: Select allpinMode(DEVICE, FUNCTION_3);


I think I am hitting the limit of pins available as regular Arduino-style digital IO pins. Without the apparently disabled RX pins, and my failed attempt to configure GPIO9 and GPIO10 as digital outputs, I'm left with GPIO16, which I've configured as RTC_GPIO0, or Function 1 on the chart.

Code: Select allpinMode(ANOTHER_DEVICE, FUNCTION_1);


So I have a few questions. Given my need for 10 digital outputs, is this the best way to go? Is it even possible to use 10 digital outputs at the same time with my application? Is there a list somewhere of which pins do and do not work is general digital IO pins? If it's not sensible to try to use 10 pins as digital IO I need to start looking at other ways to do it via a multiplexer, etc. Thanks.

Re: Configuring 10 pins as Digital Outputs

PostPosted: Wed Feb 08, 2017 2:40 am
by Barnabybear
Hi, an I2C port expander on GPIO 0 and 2 might be the best option - lots listed on the forum.
GPIO's 0, 1, 2, 3, 4, 5, 12, 13, 14, 15, & 16 are all useable as outputs. Both Tx and Rx should work as GPIO's, what are you controlling?

Re: Configuring 10 pins as Digital Outputs

PostPosted: Wed Feb 08, 2017 3:12 am
by torntrousers
Barnabybear wrote:GPIO's 0, 1, 2, 3, 4, 5, 12, 13, 14, 15, & 16 are all useable as outputs. Both Tx and Rx should work as GPIO's, what are you controlling?


And GPIO 10 when using DIO mode, right? (DIO is the default mode on many modules, eg NodeMCU v1.0, Wemos D1 mini)

Re: Configuring 10 pins as Digital Outputs

PostPosted: Wed Feb 08, 2017 5:32 am
by joshbg2k
Barnabybear wrote:Hi, an I2C port expander on GPIO 0 and 2 might be the best option - lots listed on the forum.
GPIO's 0, 1, 2, 3, 4, 5, 12, 13, 14, 15, & 16 are all useable as outputs. Both Tx and Rx should work as GPIO's, what are you controlling?


I'm controlling 10 SLR cameras, with optocouplers to isolate the circuits. I've tried a couple different NodeMCU modules and can't seem to get RX to fire on any of them. I will definitely check out the port sxpander.