diyhue / Lights

DIY lights with support for diyHue
https://diyhue.org/
172 stars 99 forks source link

ESP8266(Nodemcu 1.0) Generic_RGB_Light Pin D3 bug #33

Closed m50008 closed 5 years ago

m50008 commented 5 years ago

Hello, i think there is a problem with the pin D3 (GPIO 0). When setting pin d3 as output for the strip pins[] = {D1,D2,D3}; in line 37 the output of the pin stays high, even when the strip is turned of using the hue app. The other pins are working fine but pin d3 stays at 3.3v.

Mevel commented 5 years ago

GPIO 0 has a "special" function. it is needed to put the ESP8266 into Flash mode. It has a internal Pull-up Resistor. GPIO 0 = LOW --> Flash mode. I suggest using a different GPIO as per default in the Sketch!

m50008 commented 5 years ago

Is there a chance to user GPIO 0 as output pin? I have designed a circuit board(forgot the use of GPIO 0) and the output is now connected to this pin. For example this works uint8_t pin = D3; void setup() { pinMode(pin, OUTPUT); }
void loop() { digitalWrite(pin, LOW); delay(1000); digitalWrite(pin, HIGH); delay(1000);
}

mariusmotea commented 5 years ago

i believe PWM is disabled when it is set to value 0. In your case when you set digitalWrite(pin, LOW) the pullup resistor is somehow canceled.

m50008 commented 5 years ago

Does pins[] = {D1,D2,D3}; in line 37 change the pins? I think even when writing different pins there pin D0-D2 is setup as output. Because I wrote a print function in the setup method into the for loop where the pins are declared as output like this serial.printf("pin %d set as output", pins[pin]); and the output stays always the same. Pin D0-D2 are allways set as output, even when writing complete different pins in line 37

Mevel commented 5 years ago

Pins are assigned without D, just gpio pin number. Ex pins[] ={5,12,13}

m50008 commented 5 years ago

But even so, the output stays the same. I can write every pin there

m50008 commented 5 years ago

Now everything works, when deleting lines 421-423 and lines 658-660. Now i can define the pins as i want, the output of my print method gives the pins i have declared and the led strip works, even with pin D3 or gpio0 pins[0] = (uint8_t) json["r"]; pins[1] = (uint8_t) json["g"]; pins[2] = (uint8_t) json["b"];

and pins[0] = server.arg("red").toInt(); pins[1] = server.arg("green").toInt(); pins[2] = server.arg("blue").toInt();`

mariusmotea commented 5 years ago

i believe the issue is that you flash the firmware without to choose SPIFFS. If you want to give it one more try select on flash type 4M with 3M SPIFFS

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 2 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed as it has not had any recent activity. Thank you for your contributions.