Stefan Petrick’s way cool code for the APA102 that I’d like to add a BRIGHTNESS control knob to.
Compiles just fine and uploads also but causes strobing of the matrix and I can’t for the life of me, figure out why.
Thanks for looking and thank you Stefan, you ROCK!
Just checking…
How do you have your potentiometer wired up?
Have you done a simple setup to test the potentiometer and confirmed when you rotate it you get smooth 0-1023 values returned?
does it still strobe? If not, then it wouldn’t appear to be a problem with the potentiometer. Which doesn’t solve your problem, but gets a bit closer to finding the issue.
The code looks okay. Line 20 you can comment out - it´s not used anyway. As Marc said: check the wiring and use the serial plotter to see which values bri has. It should be 0-255 according to the pot position.
Stefan you totally got it. I upped the power supply and the strobeing stopped! Just one thing though: 10k ohm pot wired as such: center pin to 14 (A0), outer 2 pot pins 5v and ground. Now that matrix doesn’t strobe it also doesn’t dim nor brighten. The pot adds nothing to the display. Hmmm. Any ideas?
Tried Marc Miller’s suggestion and it cofirmed that the power supply was the problem.
Stefan line 110 states: byte bri = analogRead (potPinA)/4;
I changed potPinA to a 0 and no change. I’m guessing that I may have a defective pot. Ing going to wire up another one today. I’ve tried using the serial monitor and readings don’t change which raised my suspicion.
You are very kind Stefan. I am curious about speed control. I know the code runs at a very slow speed, which is just fine for me, but having a knob to twerk it a bit sounds like fun.
One more thing. You’ll notice that I got different color palettes and named each one pit1, pit2, pit3 etc. What sounds interesting is figuring out how to place the palette name (pit1 or pit5) into the area where the code gets executed via a button press. In other words I press a button and a different palette appears on the matrix. Then I could change the colors around anytime I desired without reloading the Teensy. Neat huh?
Thank you for your continued support. Here is a photo of your self modifying code display that I created.
Kindest Regards
Fred Olivas
@Freddie_Olivas
Have a look at Mark’s ColoWavesWithPalettes sketch (https://gist.github.com/kriegsman/8281905786e8b2632aeb).
It loads periodically a new predefined palette (line 617) using a timer (ln 59). Keep the logic (ln 60-61) but wrap it up in some button check function instead.
Nice build, @Freddie_Olivas ! Try an one-way glass (two-way mirror) for the frontside to go completely crazy. Some remarks: The code doesn´t run at a slow speed it´s just the animation that increments the coordinates in very small steps. On the T3.2 the framerate is arround 400 fps if I recall it right. The speed of change is mainly set in lines 162 & 165. 169 plays a minor role. I´ve not much time now - I´ll think about it how we do this with fast integer math, hopefully in the evening (12h from now) I find some time to write something. Stay tuned. About palettes I´d recommend as well to follow the link @matt_p showed.
What you are looking at IS a two way mirror in front of the display which also has mirrors around the matrix. When off it’s just a mirror. It does look awesome.