diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.52k stars 274 forks source link

Change Data Pin ESP8266 #1017

Open jaspervanisterdael opened 1 month ago

jaspervanisterdael commented 1 month ago

Feature does not already exist?

I searched and did not find an existing feature request

Summarize feature

Dear community,

I'm trying to use the D5 port instead of the RX port on my ESP8266. I changed the .ino file, but the modified script isn't working. I'm able to connect to my wifi and configure the lightstrip, but actually changing the colors isn't possible. Any tips/suggestions?

I have added/changed the following code:

#define DATA_PIN 5 // Define the pin number for the data

`void ChangeNeoPixels(uint16_t newCount) // this set the number of leds of the strip based on web configuration
{
  if (strip != NULL) {
    delete strip; // delete the previous dynamically created strip
  }
  // strip = new NeoPixelBus<NeoBgrFeature, Neo800KbpsMethod>(newCount); // and recreate with new count
  strip = new NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod>(newCount, DATA_PIN); // and recreate with new count
  //strip = new NeoPixelBus<NeoBrgFeature, Neo800KbpsMethod>(newCount); // and recreate with new count
  strip->Begin();
}

void setup() {
  Serial.begin(115200);
  Serial.println();
  delay(1000);

  pinMode(POWER_MOSFET_PIN, OUTPUT);
  digitalWrite(POWER_MOSFET_PIN, HIGH); mosftetState = true; // reuired if HIGH logic power the strip, otherwise must be commented.
 pinMode(DATA_PIN, OUTPUT); // Initialize the data pin as an output

Generic_WS2812_Strip_edit.zip

mariusmotea commented 1 month ago

Hi,

RX pin has a special hardware feature used by Neopixel library to control the leds, it cannot be changed unless the library is replaced with a different one.