Controlling Rgb Led with one Pin

Hello,

Is it possible to controll a rgb Led with one Pin.
I want to use a esp8266 to controll a Button and a rgb Led so I have just one Pin left.
does someone of you knows what i can use for this?
I have a wemos D mini but it is to big for my purpouse so everything you say should by smal.

You could add an I2C expander like the MCP23008 to add 8 input/output pins, but that may be too big. Use 3 pins for outputs for the LEDs and 1 pin as an input for the switch. Other than that I have no suggestions.

but doesn't the eps8266 only have 2 pins or can I controll more than just the gpio pins

I2C takes 2 pins to control all the devices on the I2C bus. See here for how the I2C bus works.

Which ESP8266 module do you have? You know that there are many different kinds? What all is connected to the ESP so that you have only 1 pin left? Can you post a schematic of the project so that I know what you are trying to do?

I have i think it is the esp-01 so doesnt it only have to gpio pins to the fist is the switch connected and so i only have one left, with which i want to controll the rgb led.

The MCP23008 could work but I want to make it as smal as possible so an easier solution would be nicer but if it doesn't work i will use the I2C expander

You cannot control 3 LEDs with 1 pin, period.

If you read my first post you see that you can use the MCP23008 to control the 3 LEDs and read the switch. So you use the switch pin and the left over pin for the I2C bus, then you will have an almost unlimited number of I/O pins using I2C expanders.

See this page.

A [u]NeoPixel LED[/u] only needs one "control" wire. (The are 4 pins - Power, Ground, Data-in, and Data-out.)

Im just thinking if i can use the tx or Rx for controll?
i will not need to use the Serial transfer

you can use a ALITOVE WS2812B Addressable 5050 smart RGB LED Pixel light, You will need to supply the LED with 5V, ground, and one pin from the ESP.

The #include <Adafruit_NeoPixel.h> library works with the LED. The library has C code written for the ESP.

Example of use

#include <Adafruit_NeoPixel.h>

#define PIN 26

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(10, PIN, NEO_GRB + NEO_KHZ800);

void setup()
{
  pixels.begin(); // This initializes the NeoPixel library.
}

void loop()
{

  // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {

        pixels.setPixelColor(0, pixels.Color(i * 255, j * 255, k * 255)); // Moderately bright green color.
        pixels.show(); // This sends the updated pixel color to the hardware.
        delay(200); // Delay for a period of time (in milliseconds).
      }
    }
  }
}

I'd only use the above code to test the LED.

In reply #3 I asked some questions. Why won't you answer them?

Im just thinking if i can use the tx or Rx for controll?

I don't know why not, but since you won't tell me what you have or how you are using it I can't be sure.

i have the ESP8266 ESP-01

connected to the Boad are just the switch and until now a blue Led for testing and nothing else so really nothing to complex i can try doing a shematic but if i can use the rx and tx pins it should be fine

If you are not using serial you should be able to use RX and TX pins as regular GPIO pins.

Thanks for all your help