I’m trying my hand at a an audio spectrum analyzer with a Teensy. I started with a SpectrumAnalyzer sample code (https://github.com/PaulStoffregen/Oc...ectrumAnalyzer) so it has a lot of the original code still in it.
Currently I’m working on getting the LEDs to “slide” to each new height rather than simply flashing.
MY CODE: https://github.com/moomerator/Audio-...zer_Slide2.ino
MY CIRCUIT: pins specified for OCTO2811 going to corresponding LEDs with 100Ohm resistors between each pin/signal. I’m running a teensy 3.2 for controlling the LEDs and powering them off of a 5V 20A PS.
I can make a circuit diagram if that may help but I figure it’s basic enough that it’s likely unnecessary in this case.
I’m running into two dilemmas:
With both the original code (only modification being to use USB for input) and my current code I’m getting occasional ‘off’ pixels between the ‘base’ and ‘peak’ pixels for random columns; the pixels that don’t light seem entirely random (for example, sometimes pixels 1,2,4,5,6 will go with 3 dark and sometimes 1,2,3,6 will go with 4 and 5 dark in the same row, it happens sporadically with all of the rows). I can’t use the Serial monitor to check what exact values are being passed (since I’m using the USB to transmite the audio data) but I don’t know how it would be physically possible for the Teensy to be commanding this (I think the lights are basically signalling A>B>C, A>x, B<x, C>x). Still I don’t know how it could be a hardware issue.
The ‘sliding effect’ that I’d like would require a delay of some sort (similar to how BasicTest [https://github.com/PaulStoffregen/Oc...les/BasicTest] slides). This seems to be working in my code but I obviously need a slight delay in order to be able to perceive the rises/falls as more than flashes. I’ve gotten it to work with delay but was hoping to use millis to keep everything running more smoothly but I’m not sure exactly how(/if) I could incorporate it in this case. I realize this may be a more general coding question so sorry if it’s simple but any help would be very appreciated.
Most of my coding background is based on data analysis in Python/Matlab so sorry in advance if my questions come across as ignorant or if my code is particularly ugly.