Newbie help for LED project please

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);


}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

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

Hi! Welcome to the Forum.

You have some things to take into account before going any further.

That suggests the ESP32 is going brownout, i.e. not enough power to drive it.

You're declaring a 60 LEDs led strip. In order to drive it, you'll need a 3.6 A power source. How are you powering your project?

The sketch in post #1 is just a snippet and won't even compile.

I second @UKHeliBob suggestion of reading https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum. This topic contains the information you need to provide in order to get better assistance.

Hi, @tmack
Welcome to the forum.

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.

What are you using for a power supply?

How many LEDs are in the strip?

Do you have a DMM? Digital MultiMeter?

Tom.... :smiley: :+1: :coffee: :australia: