with advance thanks to Mark Kriegsman and Marc Miller for the help they've already

with advance thanks to @Mark_Kriegsman and @marmil for the help they’ve already provided with Mark’s original twinkle Fox lights and Marc’s mod for me for my Faux prop servers…

I’ve been moving along with my ‘big’ controller, but am looking to make a smaller, user-controllerable one…basically I need to put a handle on brightness, speed & density…MAYBE color too…

I dug thru the archives & found Mark’s suggestion about adding the lines: FastLED.setBrightness(analogRead(A2)/4);
FastLED.delay(analogRead(A1)/8);
to the look to allow handles for those values, and it works like a charm…

but now I’m stuck on how to adjust DENSITY on the fly…as I guess that ‘Density’ isn’t the actual code…or call or proper term…

so basically, I have 2 pots happily adjusting SETBRIGHTNESS and DELAY, now how do I get a line in there to adjust DENSITY?

I attempted the " int densityValue = map(analogRead(densityInPin), 0, 1023, 0, 255);" but methinks I boinked the terminology…I’m guessing there’s no such thing as ‘density value’?

(BTW, look out for the faux servers on BULL and THE BLACKLIST and QUANTICO this year…)

and as always, thanks for the help!

density is defined on line 20, but its fixed.
to make it “controllable”, the line that reads
#define DENSITY 150 // 0-255 smaller is less dense
would need to become
uint8_t gDensity = 0;

Then in the loop () section you would add the analogueread() code, and set the new variable density, with the value of the knob, mapping its max and min to 0-255

e.g if the knob was connected to pin 0

gDensity = map(analogRead(0), 0, 1023, 0, 255);

Then finally change DENSITY to use the value in new gDensity on line 116

Michael,
I use them in a couple functions in this program:

Hope that helps

@Chris_Bendzel thanks for the code!–taking a look, I notice that you have:
int hueInPin = 0; // Analog input pin to the hue potentiometer

AND
int denInPin = 0; // Analog input pin to the density potentiometer

so I have a button going to A0 AND a pot going to A0?

or am I missing something?

@Stuart_Taylor THAT is working like a charm on @Mark_Kriegsman 's 2014 lights and @marmil 's 2015 mod for me…now to make either a switch dial or button for to change colors! THANKS!

I have the button hooked to a digital pin. Make sure you have the delay in there for the debouncer.

@Michael_Sime ​ no problem. I look forward to seeing them on my tv soon :wink:

That’s super Michael. Give us a ping when those new episodes come out.

@Chris_Bendzel sorry, I meant the hue & density pots…which I could assign to anything I suppose…I must have been looking at ‘denInPin=0’ and the switch code underneath and had a senior moment…that, and finally increasing the font size in Arduino…I’ll wire it up and report back!

@Michael_Sime lol! Don’t forget the pull down resistor on the switch

@Chris_Bendzel well, I tried stripping the switch bits from your code and dropping it in where I THOUGHT it should go, but no joy…whenever I try and strip the 'EVERY_N_SECONDS( SECONDS_PER_PALETTE ) ’ bits, I get no lights…and every attempt I’ve made to make the button switch to the next pallet don’t wanna work…I attribute it to me being a dummy and missing something obvious…like a semicolon

@Michael_Sime It could be a semicolon. Can you post your code to github so we can look at it?

Copy and paste your code to that link and reply with the new URL that it generates.

@Chris_Bendzel ok here it is:

I don’t have any of the pushbutton code in there because it kept boinking things, so I reset to zero to start anew…

basically I wanna kill the auto switch to next palette thing, and have the unit start on palette #1 & then on a button press, go to the next & etc…

I think that might be easier for my end users than a color knob, especially if we have multi-color animations…

@Michael_Sime ​ a small aside.

The delay() function used for “debounce” in the main loop() is going to pause the animations.
FastLED has its own delay function, which will still service the LEDs.

Try using http://FastLED.delay() in place of the regular delay.

@Stuart_Taylor
you mean the one on line 74? in the setup-’ delay( 3000 ); //safety startup delay’? that one has been there from the get-go

or the one on line 105, which was part of the switch code, that I commented when it didn’t work?

@Michael_Sime ​ The one that is commented out and a part of the switch function.
Using delays like that, pause all execution at that point.

I’m going to have a look at the advance palettes on button press later (just enjoying some daddy day care).

@Stuart_Taylor copy you…most appreciated…I’m off now to make twinkle with 15000 lumens of light spread over a 11x20 screen…back to the little lights later!

Hey @Michael_Sime what was the purpose of this line?

FastLED.delay(analogRead(A1)/8);

what was it to achieve?

I think the idea there with the variable delay based on the analogue read allows the client to dial in the blink rate. That might give a perfectly good visual result, but @Michael_Sime ​​ maybe the potentiometer should be adjusting TWINKLE_SPEED (from 0-8)?

@marmil CORRECT…I swiped that line from another post where Mark suggested adding handles to his twinkle sketch…

I’ll do whatever is easiest & most effective…basically I want my end user to have a simple way to adjust brightness, speed, density and switch pallets…

I’m away from my workbench until Sunday night though…