Stefan Petrick's way cool code for the APA102 that I'd like to add a

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?

I should probably also ask, if you take the potentiometer out of the equation by just hard coding line 110 to a value of 255

//byte bri = analogRead(potPinA) / 4;
byte bri = 255;

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.

Will try your suggestion tomorrow. 10k ohm pot middle pin to pinA0 on Teensyduino 3.5 and outer pins to v+ (5v) and GND.
Thank you Marc.

@Freddie_Olivas I’m not sure but I thought Teensy 3.5 is just 5V tolerant on the >digital< pins. Analog should only be max. 3.3V.

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.

Might it be that you power supply collapses when the brightness is set too high? With 256 leds these animation draws up to arround 12 amps…

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.

When using pin 14 you use analogRead(0); right?

The analog inputs do NOT tolerate 5V. Connect the pot to 3,3V & Gnd and another analog pin. Maybe you already damaged A0.

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.

Try another analog input and make sure to give it max 3,3V this time.

Problem solved!!! Bad pot. That’s it. Thank you all.

You´re welcome. If you want to add more pots for r, g & b filter or overall color, speed, … I´m happy to see it or help to optimize your approach.

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

missing/deleted image from Google+

@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.