Hello
I'm using an ESP32 board and trying to control an LED strip. I have the data PIN on D2 on the board. The LED strip WS2812B doesn't seem to be recognised in the code as the code doesn't go green.
Although the code seems to compile and upload, it ends with message about restarting the board and the LEDs don't respond. I'd appreciate any help - I realise this is probably very simple, but I'm new to this.
Thank you
#include <FastLED.h>
#define NUM_LEDS 60
#define LED_PIN 2
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(50);
}
void loop() {
// put your main code here, to run repeatedly:
leds[0] - CRGB::Red;
leds[1] - CRGB::Green;
leds[2] - CRGB::Blue;
FastLED.show();
delay(250);
}
Please post your full sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
It is also helpful to post error messages in code tags as it makes it easier to scroll through them and copy them for examination
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.