Seeed Studio XIAO - ESP32-C3 program works while runing trough arduino IDE but not on a power source on it's own

I have been stuggleing with this problem as my current program for useing the XIAO with a WS2812 LED strip works properly when I run it trough Arduino IDE like it's supposed to but when I just plug it into a powersource (that be my laptop or a powerbank) the progam doesn't work properly. It seems to take 3 steps and switch inbetween those instaid of following the full range from dim to bright and back. I have no idea how to fix it as the program works when it's run trough Arduino IDE. I did use the FastLED libaray.

I use the following code:

#include <FastLED.h>
#define LED_PIN D10
#define NUM_LEDS 15
#define LED_TYPE    WS2811  //WS2811, WS2812, WS2812B
#define COLOR_ORDER RGB
#define CHANNEL     0
#define BRIGHTNESS 255
#define DATA_PIN D10

int ledPin = D10;


CRGB leds[NUM_LEDS];



void showLed() {
  for (int i=0; i<NUM_LEDS; i++ )
{
leds[i] = CRGB(239, 0, 255); //groen rood blauw
 uint8_t brightness = (exp(sin(millis() / 3000.0 * PI)) - 0.368) * 42.546;
  Serial.println(sin(brightness));
 if (brightness<5){
   brightness=5;
   FastLED.setBrightness(brightness);}
 else{
  FastLED.setBrightness(brightness);}

  FastLED.show();
}
}

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN>(leds, NUM_LEDS);
  Serial.begin(9600);
}

void loop() {
  showLed();
  
}

Below is how it is currently set up

Does anyone have a idea on what I need to do to give the LED strip a 'breating' effect when I plug it into a powersource?

Thank you in advance

Please show your schematic, including the power lines.
How do you power your board and your led strip?

Hi, sorry it took me a bit I have been buzzy with some other projects but I added a picture and a schematic. Let me know if you need anything els! I'm sorry if it's pretty clear that programming is not something I usaly do

@b707 is the addes schematic and picture what you had asked for? If not how can I improve it to make it more clear?

Sorry, I don't understand what is drawing in your picture

Hello, I have the same problem, have you found a solution?
The best solution I've found so far is to reset the card until it works, which isn't very practical.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.