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?

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?

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

blnkjns

Posts: 304
Joined: Fri Oct 02, 2020 3:33 am

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

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?

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: 304
Joined: Fri Oct 02, 2020 3:33 am

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

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.