rm-hull / luma.led_matrix

Python module to drive LED Matrices & 7-segment displays (MAX7219) and RGB NeoPixels (WS2812 / APA102)
https://luma-led-matrix.readthedocs.io
MIT License
519 stars 157 forks source link

Python 3 Support #17

Closed depado closed 9 years ago

depado commented 9 years ago

Hi, It only works with Python 2.7 for now. Main problem is with xrange, may I suggest you add Python 3 support by try except the xrange function and set it to range if NameError ? =)

rm-hull commented 9 years ago

Sure - never really considered Python 3 support, but I will add something like:

try:
    xrange
except NameError:
    xrange = range

and check for other 2-to-3 compatibility issues as well

depado commented 9 years ago

In led.py line 360, there is a division. Division changes in python 3, it will return a float unless '//' is used. Anyway I tried your program but nothing happens on the matrix. When I plug the chip the other way around, it displays 3 exclamation mark, do you know anything about that kind of behaviour ? :/

rm-hull commented 9 years ago

So, can I assume that you have a matrix rather than seven segment? and when you say "plug the chip the other way" do you mean the max7219 IC or the LED matrix?

It is easy to get the LED matrix plugged in the wrong way.

What happens when you run python examples/matrix_test.py ? Can you upload a picture of the circuit board when it is showing the exclamation marks?

Also:

depado commented 9 years ago

Yes I have a matrix. The led matrix is plugged the right way (notched side is on the bottom). Here are some pics of how I wired it. Pictures Nothing happens when I run the program.

Python 2.7 is installed and so is your lib (no errors when I start the program) I use Raspberry Pi Raspbian Wheezy

depado commented 9 years ago

(I have put some print in the program to see what's executed, it runs smooth, but nothing happens on the matrix, I suspect a problem with the wiring or the assembly of the matrix... Though I have no idea what I could have done wrong)

img_20150313_122538 img_20150313_122614

As you can see, it displays this. The chip is the wrong way, or at least I think so. What do you think ?

rm-hull commented 9 years ago

If you look at this pic, the semi-circle notch at the end of the chip should be aligned with the white outline below. The writing on the chip should be oriented the same way as the white 'MAX7219' lettering on the printed circuit board... Looking at your pics, the chip is plugged in the wrong way round.

image

The wiring from your earlier pictures looks correct.

Try changing the chip round (and hope that hasnt been fried).

If it still doesnt work, try taking out the LED matrix, and rotate it 180 degrees and re-insert it

depado commented 9 years ago

Already tried all that. I guess I fried the chip or something. I'll buy a new one and try again. Thanks for the help ! And thanks for the lib !