Spectrum analyzer for esp32


i temporarily uploaded on github if you want to have a look

You can also use a Github gist if you want to share something more temporary without having to create a full GitHub repository.

Is waterfall the pattern with an issue?

If so, I only glanced at the code but it seems possible that your x and/or y coordinate could go out of the bounds of the matrix, and then you’re accessing memory you didn’t intend to. You could do something simple like add a check inside XY() that constrains the values between 0 and matrixWidth-1, etc. Try that first and let me know if you still see issues.

1 Like

It’s upside down because the sketch assumes the y axis starts from the bottom. SmartMatrix Library starts the y axis from the top. Easiest thing to do is to change the XY function to reverse Y, then you don’t have to change all the patterns that reference the XY function with the inverted logic.

1 Like

you are right it is waterfall pattern which is not working. I will try and let you know

Hi. I am sorry i have been out for quite a few days. after a hard work and lot of trials and error i finally got it working: but two things are not working yet.
due to improper" XY " coordination display is upside down I tried few things but things got worse that is why I left it as it is. switching between patterns is not working properly it get stuck on last pattern and then you have to reset esp32 there might be work around for this by setting “bool autoChangePatterns = false;” to true but i did not tested it.
here is link if you want to try it out:

i will try to fix patterns switch problem as soon as possible

Change this line in your XY function:

  i = ((kMatrixHeight - 1 - y) * kMatrixWidth) + x;

You have 5 cases in switch (buttonPushCounter), but that variable can be 0-5 -> 6 values. Perhaps you intended to use % 5 rather than % 6 on line 324?

now upside down problem is gone thank you so much , and yes there is mistake on line 324 i forgot to update this line after removing a pattern i will update code right now.

After updating line 324 pattern switching is still not working properly. and thank you so much for your great help now repositories is updated. if you find something else improperly please let me know. I am not a programmer in any ways but i will try to fix it.

There’s another % 6 on line 111. Lines 122-125: just read the button on every loop? I don’t understand why that if is there at all.

Hi i tried as you suggested and if i set variable to % 5 then pattern at case 6 never shows up again i set it to % 6 and now it is working fine and every pattern can be changed without resetting esp32 . i think problem is gone now. and if statement at 122-125 is again a remnant from waterfall pattern that i forgot to remove and now i also removed it from GitHub , thank you soo much. it took me soo long to just migrate sketch from fast led to smart matrix. But I learned so much during this, thanks again.

1 Like