-->
Page 1 of 3

ESP01 with 3 Pinouts needed

PostPosted: Mon Feb 08, 2016 5:44 pm
by Suroh
Hello everyone!

I recently received my first ESP01 and already programmed it the way i need it to work. Now my plan is to have 3 GPIO-Pins being controlled by a hosted Website, which in turn control my RGB-LED-Strip via PWM and a transistor.
For this case i need 3 GPIOs but I don't know whether it is possible to reuse any of the 4 other pins as GPIO (excluding VCC, GND, GPIO0 & GPIO2).
I read that the reset Pin is also a GPIO pin but I'm not sure how to address that one...

Any help is much appreciated :)

Greetings
Suroh

Re: ESP01 with 3 Pinouts needed

PostPosted: Tue Feb 09, 2016 3:02 am
by schufti
Hi,
don't know for the reset (doubt it) but you can use Rx and Tx pins

Re: ESP01 with 3 Pinouts needed

PostPosted: Tue Feb 09, 2016 3:46 am
by Suroh
Good to know! Where can I find an explanation or example on how to address them in my code?

Re: ESP01 with 3 Pinouts needed

PostPosted: Tue Feb 09, 2016 5:06 am
by Barnabybear
Hi, as schufti stated you can use GPIO 1 (Tx) and GPIO 3 (Rx), GPIO 3 is the better of the two as you can still use Tx to debug and it doesn't mess with booting.
Code: Select all//pinMode(pin, FUNCTION_number from table)
pinMode(3, FUNCTION_3);

Sets as a GPIO then can be used as normal, it becomes GPIO 3.
Table of functions can be found here http://www.esp8266.com/wiki/doku.php?id=esp8266_gpio_pin_allocations

Toptip: Use
Code: Select allanalogWrite();

insted of PWM commands. The analog output is PWM and you don't have to mess about resetting it everytime you change the duty cycle and end up with flicker.

If you connect the ESP to a PCA9685 you can control 5 RBG strips with gama correction aswell - there is a stepper motor breakout board https://www.adafruit.com/product/815 that works well. When I get chance I'll do a write up.
Code: Select all//Gamma correct (2.0) near as dam it.
12_BIT_VAL = (((8_BIT_VAL)*(8_BIT_VAL))/16)