Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By Suroh
#40737 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
User avatar
By Barnabybear
#40775 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)