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!



Blinking Halloween ...
 
Share:
Notifications
Clear all

[Solved] Blinking Halloween Eyes with different colors

36 Posts
3 Users
0 Reactions
7,978 Views
(@bravozulu)
Active Member
Joined: 8 years ago
Posts: 15
 

Hi Hans !

After many searches and tests this Saturday and Monday, here are the results.

First and overall it's quite successful with 3 LEDs  
I played a lot with the settings to get very slow and smooth effects.
(Also with: EVERY_N_MILLIS(180) // do this only every x milliseconds)

On the other hand with 1 LED, the main problem are the blacks that I would like to be able to adjust. (As a general rule, I would like very little black between the color sequences).
LEDStatus[led].active = (random(60)<50);
Compared/Added function to "inactive" ?

Here are +/- the values used:
- 3 colors: CRGB(0xFF,0x66,0x66), CRGB(0xE6,0x17,0x17), CRGB(0x73,0x00,0x00)
#define MINSTEPSIZE 1 // We need to set a minimum stepsize, >0 !!
EVERY_N_MILLIS(180)
MINSTEPSIZE+random(8) // make fade out different from fade in speed
  LEDStatus[led].active = (random(1000)<200);
  LEDStatus[led].colorBase = palette[random(NUMCOLORS)];
  LEDStatus[led].isFading = false;
  LEDStatus[led].maxvalue = random(16,128);
  LEDStatus[led].minvalue = 16;
  LEDStatus[led].currentvalue = LEDStatus[led].minvalue;
  LEDStatus[led].stepsize = MINSTEPSIZE+random(4);

I have a little trouble understanding the nesting of these commands:  
- #define MINSTEPSIZE 1 // We need to set a minimum stepsize, >0 !!
- MINSTEPSIZE+random(8) // make fade out different from fade in speed
- LEDStatus[led].stepsize = MINSTEPSIZE+random(4);

About: "Serial message", I do not understand yet. Anyway here is what I found about "ATTiny85" = No Serial (UART). Yes SPI and I2C.
"You may notice, on the listing of special pin functions there are no UART RX’s or TX’s. That’s because the ATtiny85 doesn’t have a built in hardware UART. If you try to compile any Arduino code with Serial.begin(9600) ’s or Serial.print() ’s you’ll get an error".

I spent quite a bit of time looking for color references. We soon realize that RGB does not match !
With FastLED, it is therefore interesting to switch to HSV/HSB - "Rainbow" = Default FastLED = More evenly-spaced color bands (yellow).
I found a Color Converter that can give a first reference in 0-255 either "winHSL255".

I would also like to add (in addition to: LEDColorCorrection) a "Temperature correction" (White balance), for example useful for photo/video, or in a theater...
setTemperature (Halogen: 3200 Kelvin / HighNoonSun: 5400 Kelvin).

About the desired function (setValue), "setBrightness" vs "nscale8" (0-255) can only be used globally ?

For LEDs "WS2812B", should a more precise distinction be added, or "NEOPIXEL" (Neopixel - Aka the WS2811 or WS2812 or WS2812B) is sufficient ?  + http://fastled.io/docs/3.1/class_w_s2812_controller800_khz.html

So much for today - hard to summarize.
I am waiting for your comments  
Thank you in advance.

Guy-Laurent

PS: An idea/references about creating a Color palette - Programmable Color Palettes (CLUTs).


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter  

Hi Guy-Laurent!

Wow that's a lot of questions hahah ....

To avoid black, you could set the LEDStatus[led].minvalue to a higher value. Depending on your LEDs this could be for example 32 or 64. You'll have to try which one works best. The idea is that a LED will never get darker than a give value (I hope I implemented that correctly).

If you want a LED to be active all the time then set LEDStatus[led].active = true; ... not sure if that will work, but again: that was the idea ... hahah.

As for MINSTEPSIZE; I added that to avoid a stepsize of zero. When this would be zero, then a LED would never get brighter or darker since we never add or remove anything and therefor it will never reach is max or min value. So the LED just remain on and the same brightness all the time.
Because of the random value we add, in the end all LEDs will be solid and not move.
Make sense?

The serial messages are of no importance for your final product. I only added them so I could debug the values.
So you can remove any line that starts with "Serial.".

Implementing color temperature seems to be easy (temperature names: link).
I have not tested this, but this is how it should work (if I understood correctly).

#define TEMPERATURE Tungsten100W  // see the possible names in your links
...
void setuo() {
...
   FastLED.setTemperature( TEMPERATURE_1 );
...
}

Unfortunately, I do not (yet) have an example to go to HSV instead of RGB.

Selecting the right LED type, is not only significant for proper colors (which will always remain a guess), but more so for proper controlling the controllers in the LED blocks.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter  

Oops, .... typo in the code:

void setuo() should of course be void setup().


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter  

As for trying CRGB, you might be able to replace all CRGB occurrences with CHSV (see documentation).
I have not tested this yet, but it might just work. 


   
ReplyQuote
(@bravozulu)
Active Member
Joined: 8 years ago
Posts: 15
 

Hello Hans,

You are great 

Thank you for all these answers.
Of course I will try all this.
I will keep you up to date.

See you soon,
Guy-Laurent


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter  

You're welcome! 


   
ReplyQuote
Page 3 / 3
Share: