0

Rotate Mini 0.8" 8x8 LED in circuitpython?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Rotate Mini 0.8" 8x8 LED in circuitpython?

by mevander on Mon Apr 05, 2021 9:00 am

Hey.

I'm testing the space invader tutorial to get used to circuitpython and the 8x8 LED matrix. After a copy-paste of the supplied code (and spending a long time trying to free up enough memory for the libraries needed) I got the LED matrix to work. However, the pattern is rotated 90 degrees. I was looking for a function to rotate it in the matrix library but didn't find anything? Any suggestions?

mevander
 
Posts: 3
Joined: Mon Apr 05, 2021 8:51 am

Re: Rotate Mini 0.8" 8x8 LED in circuitpython?

by blnkjns on Mon Apr 05, 2021 9:06 am

What software do you use? This site only shows Arduino code.
Stupid question, but why not rotate the whole assembly?

blnkjns
 
Posts: 639
Joined: Fri Oct 02, 2020 3:33 am

Re: Rotate Mini 0.8" 8x8 LED in circuitpython?

by mevander on Tue Apr 06, 2021 1:55 am

blnkjns wrote:What software do you use? This site only shows Arduino code.
Stupid question, but why not rotate the whole assembly?


I'm following the tutorial (https://learn.adafruit.com/trinket-slas ... ython-code) and according to the images it should work. I could rotate it but it will make the pendant a bit less nice I think and I also want to figure out why to do it :)

mevander
 
Posts: 3
Joined: Mon Apr 05, 2021 8:51 am

Re: Rotate Mini 0.8" 8x8 LED in circuitpython?

by blnkjns on Tue Apr 06, 2021 7:18 am

In that code you can just swap x and y here:
Code: Select all | TOGGLE FULL SIZE
    if frame_count < len(animation):
        for x in range(x_pix):
            for y in range(y_pix):
                matrix.pixel(x, y, animation[frame_count][x][y])

blnkjns
 
Posts: 639
Joined: Fri Oct 02, 2020 3:33 am

Re: Rotate Mini 0.8" 8x8 LED in circuitpython?

by mevander on Sat Apr 10, 2021 12:28 am

Of course! Now I feel stupid. Thank you very much!

Switching it to

Code: Select all | TOGGLE FULL SIZE
matrix.pixel(x, y, animation[frame_count][y][x])


did the trick!

mevander
 
Posts: 3
Joined: Mon Apr 05, 2021 8:51 am

Please be positive and constructive with your questions and comments.