Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




About Theatre Chase...
 
Share:
Notifications
Clear all

About Theatre Chase effect on LED strip with WS2812b

6 Posts
2 Users
0 Likes
2,572 Views
(@Anonymous)
Joined: 1 second ago
Posts: 0
Topic starter  

Hi,

I imitate theatre chase sample code in the website on my LED strip, but the effect of my The light strip becomes a stroboscopic effect instead of Theatre Chase effect.

my code is as follows:

void theaterChase(uint8_t red, uint8_t green, uint8_t blue, int SpeedDelay) {
  for (int j = 0; j < 10; j++) { //do 10 cycles of chasing
    for (int q = 0; q < 3; q++) {
      for (int i = 0; i < LED_FRAME_SIZE; i = i + 3) {
        setPixel(i + q, red, green, blue); //turn every third pixel on
      }
      showStrip();

      osDelay(SpeedDelay);

      for (int i = 0; i < LED_FRAME_SIZE; i = i + 3) {
        setPixel(i + q, 0, 0, 0); //turn every third pixel off
      }
    }
  }
}

the LED_FRAME_SIZE is all LEDs in my LED strip.

I also upload my LED strip video on youtube. (22) LED strip effect demo - YouTube

Please guide me what's wrong on my code.

Thanks.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2654
 

Can you post the entire sketch?
The code you posted should not display the strobe effect at all?
I'm also not familiar with the "osDelay" function?


   
ReplyQuote
(@Anonymous)
Joined: 1 second ago
Posts: 0
Topic starter  

Hi,

 

The osDelay is delay function in free RTOS, the same as Arduino.

The entire sketch is as follows:

 

typedef struct
{
uint8_t B;
uint8_t R;
uint8_t G;
} led_pixel_t;

led_pixel_t g_colors[LED_FRAME_SIZE]={0};

void setPixel(int Pixel, uint8_t red, uint8_t green, uint8_t blue) {
g_colors[Pixel].R = red;
g_colors[Pixel].G = green;
g_colors[Pixel].B = blue;
}

void Light_Style_Curtain(void *data, int len)
{
light_style_color_curtain *tData = (light_style_color_curtain*)(data);

for(int i = 0; i < tData->u8RgbColorNum; i++ )
{

theaterChase(tData->u8aColorRgb[i].red, tData->u8aColorRgb[i].green, tData->u8aColorRgb[i].blue, tData->u8ColorSpeed);
}

}

 

void theaterChase(uint8_t red, uint8_t green, uint8_t blue, int SpeedDelay) {
  for (int j = 0; j < 10; j++) { //do 10 cycles of chasing
    for (int q = 0; q < 3; q++) {
      for (int i = 0; i < LED_FRAME_SIZE; i = i + 3) {
        setPixel(i + q, red, green, blue); //turn every third pixel on
      }
      showStrip();

      osDelay(SpeedDelay);

      for (int i = 0; i < LED_FRAME_SIZE; i = i + 3) {
        setPixel(i + q, 0, 0, 0); //turn every third pixel off
      }
    }
  }
}

 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2654
 

Hi ...

ehm, I'm pretty this is not the entire sketch ... I'm missing a lot of details here ...
Again; without seeing the entire sketch, I cannot see what may or may not be going wrong ... 🤷🏻‍♂️

I guess the issue here is that you're not working with regular Arduino code, and instead are working with RTOS (I have no experience with RTOS).
Maybe this is related to whatever library is controlling your LED strips, and how it is implemented under RTOS?


   
ReplyQuote
(@Anonymous)
Joined: 1 second ago
Posts: 0
Topic starter  

Hi Hans,

Yes. I implement the LED effect on RTOS with MCU(for example, ESP32...etc.), not Arduino platform. I used SPI interface of MCU and ws2812b specification to control the LED strip. 

BTW, most of the effects on your website, I can implement except for theater chase, so thanks again for providing amazing effect for reference.

I found the output voltage of the MCU is too low for LED strip, I will debug the hardware issue first, then check the effect issue.

 

 

 

 

 


   
ReplyQuote


 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2654
 

It is always best to power the LED strip separate from your controller ... 😊 
(they do need to share GND though)


   
ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: