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…)
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
@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!
@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!
@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
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.
@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!
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…