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!



New KITT effect que...
 
Share:
Notifications
Clear all

[Solved] New KITT effect question

4 Posts
2 Users
0 Reactions
1,725 Views
(@mr_bridger)
Active Member
Joined: 9 years ago
Posts: 7
Topic starter  

Hi Hans,

I've been tinkering adding various other effects into my sketch, but the only one that ive had issues with is the "New KITT". I'm not sure if its like it for everyone, but it seems to strobe / flash for me. the effect works ok, but the LEDs just seem to flash very fast rather than stay on solid in the  lit section, could it be a refresh rate thing maybe? i dont fully understand how the effect works, so maybe you could shed light on it, does it "re draw" the whole strip as it were? and any way of improving it?

I'm using 191  WS2811 on a Trinket Pro 5V 16Mhz, with a 40 wide "Eye size" -   NewKITT(255, 0, 0, 40, 10, 50)

Thanks

Ross. 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2864
 

Hi Ross,

sorry for the late reply - traveling for work ... 

As you might see in the video; I've not experienced the "flickering" (strobe) effect.
What you could try, is modify the "setAll()" function. It defines all LEDs to become black (OFF) and then actually shows it.
Each function in the New KITT effect uses this and after that it sets the "new" colors.
Now, showing the change in that function could theoretically make the strip flicker when the Arduino (or similar device) is not keeping up or too slow.

void setAll(byte red, byte green, byte blue) { 
  for(int i = 0; i < NUM_LEDS; i++ ) { 
    setPixel(i, red, green, blue); 
  } 
  // showStrip(); // Comment this line out
}

The downside would be that it might cause undesired effects with the other effects. If that happens, just make a second "setAll()" function, for example

void setAll2(byte red, byte green, byte blue) { 
  for(int i = 0; i < NUM_LEDS; i++ ) { 
    setPixel(i, red, green, blue); 
  } 
}

You'd have to change the calls to "setAll(...)" in the New KITT function to "setAll2(...)".

In essence, every "setPixel()" call sets a color in an array.
But it does not affect the strip at all, until "showStrip()" is being called, which passes the array on to the strip.

So recap:

Currently the code defines all LEDs as black, materializes it by calling "showStrip()", and after that it will "draw" the next step in the effect and call ShowStrip again.
Skipping ShowStrip() in the setAll() function would be perfectly fine, and potentially reduce flickering.

Let me know if that worked 


   
ReplyQuote
(@mr_bridger)
Active Member
Joined: 9 years ago
Posts: 7
Topic starter  

Hi Hans,

Many thanks for your reply, i can confirm this worked perfectly! i did as you said and added a "setAll2" as i didn't want to mess up the rest and it all worked great! 

Thanks again. :-)

Ross. 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2864
 

Awesome! 

Thanks for letting us know as well, hopefully others will find benefit in this as well ... 


   
ReplyQuote
Share: