I'm going crazy, there is clearly something I'm missing here. I have a NodeMCU V3.0 and a 5V LED strip WS2812B with 10 diodes. I tested this first with a 5V 0.3A power supply, only powering 3 diodes, this worked fine.
Than I changed the power supply to a 5V 2A (Measured to 5.2V) and now the colours are way off, they even change everytime its updating, even though nothing is changed. I put my voltmeter across "D3" and "GND" and suddently the LEDs were perfect and stable.
If I remove it again, the LEDs change to random colours again, I tried pulling "D3" to ground with a 10 kOhm resistor, but this doesn't change anything.
What is going on here, why isn't it working, and why does it work with the voltmeter?
Code:
#include <ESP8266WiFi.h>
#include <FastLED.h>
#define LED_PIN 3
#define NUM_LEDS 10
CRGB leds[NUM_LEDS];
int R = 255;
int G = 90;
int B = 10;
//Set up MQTT and WiFi clients
WiFiClient client;
void setup()
{
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
Serial.begin(9600);
//Connect to WiFi
Serial.print("\n\nConnecting Wifi... ");
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}
Serial.println("OK!");
pinMode(D4, OUTPUT);
digitalWrite(D4, HIGH);
}
void loop()
{
leds[0] = CRGB(255, 0, 0);
leds[1] = CRGB(0, 255, 0);
leds[2] = CRGB(0, 0, 255);
FastLED.show();
delay(5000);
}