Giter Club home page Giter Club logo

luma.led_matrix's People

Contributors

bauerj avatar bitdeli-chef avatar bramverb avatar briceparent avatar emlyn avatar gadgetoid avatar it-berater avatar jlnprssnr avatar michaellee1019 avatar pokebox avatar rm-hull avatar swoodford avatar tarasius avatar terokorp avatar theraytracer avatar thijstriemstra avatar ttsiodras avatar twdkeule avatar webmonger avatar wkapga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luma.led_matrix's Issues

Convert LICENSE.md to rst

  • I'd also link to it from the README instead of duplicating it there
  • make sure to adjust the path in MANIFEST.in

device = led.matrix(cascaded=1) File "/usr/local/lib/python2.7/dist-packages/max7219/led.py", line 51, in __init__ self._spi.open(spi_bus, spi_device) IOError: [Errno 2] No such file or directory

i have error
pi@raspberrypi:~/max7219 $ sudo python examples/matrix_test.py
Traceback (most recent call last):
File "examples/matrix_test.py", line 8, in
device = led.matrix(cascaded=1)
File "/usr/local/lib/python2.7/dist-packages/max7219/led.py", line 51, in init
self._spi.open(spi_bus, spi_device)
IOError: [Errno 2] No such file or directory

No way to rotate fonts?

Good day.
Is there any way to rotate font without re-specifying constants of characters? I.e. some rotation parameter. If no, it would be nice to have.
P.S.: I have Cyrillic font if somebody needs it.

Issue with installation

I ran the setup.py from the recent update/changes from the output it looks like all went through correctly, however if I run "sudo python matrix_test.py" I get the following:

Traceback (most recent call last):
  File "matrix_test.py", line 8, in <module>
    import luma.led_matrix.legacy as legacy
ImportError: No module named luma.led_matrix.legacy

I also tried on another PiZero with install va PIP and received the same error/issue.

max7219.led module not found

After running:

sudo python max7219/examples/matrix_test/py

I get the error:

Traceback (most recent call last):
    File "max7219/examples/matrix_test.oy", line 3, in <module>
    import max7219.led as led
ImportError: No module named max7219.led

There were no errors when cloning from the repo. I have installed wiringPi, and I have also changed the SPI settings, just like in the README.txt

Any help would be greatly appreciated.

installing error

i launch
'''shell
sudo python setup.py install
'''
and i have this error :
'''Shell
building 'max7219.spi' extension
creating build/temp.linux-armv6l-2.7
creating build/temp.linux-armv6l-2.7/src
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/spi.c -o build/temp.linux-armv6l-2.7/src/spi.o
src/spi.c:20:20: fatal error: Python.h: Aucun fichier ou dossier de ce type
compilation terminated.
error: command 'gcc' failed with exit status 1
'''

Would this work on a Orange pi pc?

Hello,

does this library have something specific to the Raspberry Pi or do you think that it would work on a Orange Pi Pc too?

Thanks

Python 3 error in matrix_test example

$ sudo python3.5 examples/matrix_test.py 
Traceback (most recent call last):
  File "examples/matrix_test.py", line 20, in <module>
    for intensity in xrange(16):
NameError: name 'xrange' is not defined

basic led manipulation

Probably a stupid question but does the updated package still provide the capability to manipulate individual leds - it's all I need to do ! [ for instance - set_pixel(0, 4, 1, redraw=False) ]

If so some info and examples in the documentation would be great

Type of Raspberry Pi

I am working across most variants but in this case the specific issue is with a pi zero application, that I would like to migrate from the old library

Linux Kernel version

Linux raspberrypi 4.4.34+ #930 Wed Nov 23 15:12:30 GMT 2016 armv6l GNU/Linux

Not an issue: max7219 Python Webserver!

I'm sure I'm not the first, but I've written a Python-based web server that communicates with a max7219 8x8 LED Matrix connected to a Raspberry Pi. My test system is a Pi 3 running Kali Linux, but I'm sure it'll work on most other installation. It requires Python 2.7.

You can download it from SourceForge here:

https://sourceforge.net/projects/snarlwin/files/Extras/RedPowder/

and there's more information about it here:

http://snarl.fullphat.net/max7219-led-array-on-raspberry-pi/

It's also usable from Snarl (our enterprise notification platform).

How to scroll text in from top/bottom?

If possible, how would I go about scrolling text down from the top, or up from the bottom.

I can get the letters already displayed to scroll down after being drawn on the display, but how would you scroll letters up from the bottom and stop in position on the display. (like scrolling left-to-right, except stopping once they reach the top of the display.)

Issue with "scrolling" code, but "scrolling alphabet" works fine

Hey,

I am running a Raspberry Pi 3, and using this seven segment device with this code nicely.

I just tried to implement the scrolling text code as described, but nothing happens at all. The code does not provide an error when executed, the display shows nothing, and command line simply returns to waiting for its next command.

# Scrolling
print('Scrolling...')
for x in range(2):
    for _ in range(8):
        device.scroll_right()
        time.sleep(0.1)
    time.sleep(1)
device.clear()

I then tried the scrolling alphabet code as below, it works perfectly:

# Scrolling Alphabet Text
print('Scrolling alphabet text...')
device.show_message("HELLO EVERYONE!")
device.show_message("0123456789 abcdefghijklmnopqrstuvwxyz")

I'm just wondering if anyone else is having troubles with the scrolling... section?

Linux Kernel version

Linux pi3 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux

Convert README.md to .rst

If README.md is converted to .rst it can be included in the readthedocs index page and serve as it's main page.

Two functions displaying an image

Hi
In my script i have two functions displaying an image on the matrix and they are called at different time in differents loops, but when one is called, it erases the image of the previous one, i can't have images of the both functions at the same time on the matrix.
I wonder if there is a solution to add the two images, to display them at the same time.

(I'm sorry for my english it's not my mother tongue)

Type of Raspberry Pi

I'm using a Raspberry Pi 1 B

Add support for proportional fonts

All the existing fonts are 8-byte fixed widths. The character tiles can be trimmed to give the illusion that they are proportionally spaced using a wrapper class as follows:

class proportional(object):

    def __init__(self, font):
        self.font = font

    def __getitem__(self, asciiCode):
        bitmap = self.font[asciiCode]
        # Don't trim the space character down
        if asciiCode == 32:
            return bitmap
        else:
            return self._trim(bitmap) + [0]

    def _trim(self, arr):
        nonzero = [idx for idx, val in enumerate(arr) if val != 0]
        if not nonzero:
            return []
        first = nonzero[0]
        last = nonzero[-1]+1
        return arr[first:last]

Python 3 Support

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 ? =)

Python3 installation, module not found

After installing from source with sudo python3 setup.py install the luma.led_matrix module cannot be found by python3, while the correct .egg is clearly in the PYTHONPATH

sys.path = ['/home/pi/Python/luma.led_matrix', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-arm-linux-gnueabihf', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/local/lib/python3.4/dist-packages/luma.led_matrix-0.3.0-py3.4.egg', '/usr/lib/python3/dist-packages']
Traceback (most recent call last):
File "./8_digit.py", line 18, in
from luma.led_matrix.device import max7219, sevensegment
ImportError: No module named 'luma.led_matrix'

Showing text without scrolling

Is there currently a way to show some string centered (without scrolling) if it fits on the displays? It might be useful for showing things like the current time or temperature where you don't want the text to scroll.

If not, I could send you a Pull Request if you like.

MAX7219 - any way to slow scrolling text down?

Raspbian Jessie on a Pi 3 running headless with a MAX7219 8x8 Matrix and single Blink(1) connected.

When doing:

legacy.show_message(device, text, fill="white", font=font)

The text rockets across the LED like greased lightning! Is there any way to slow it down? :)

One Module of four matrices (8x8) all showing the same

hi,
i have an already cascaded module, where 4 pieces of 8x8 matrix-modules are bound together with the pcb on the back.

if i run the test with cascade=1, they 4 modules (or should i say the 1 module with 4 matrices) show all the same on there four 8x8 segments.

if i run the test with cascade=2, the 4 modules show all the same, with one colum later on the next module.

how do i set orientation (or something else?), that the scrolling goes over the one module (which consists out of four single 8x8) modules from left to right/right to left ---
and not showing all the same?

thanks for helping out. i found your python very helpful,
your explantions get me starting in a minute. great! ๐Ÿ˜„
๐Ÿ‘

its not an issue, but a doubt

how to use specify set of digits for different purpose?
for example
first 3 digits for high score
next 2 digits for timer
last 3 digits for current score

thanks in advance for your help
dev

Usage of time.sleep in show_message blocks app

show_message has a coupe of calls to time.sleep, causing my PyQt5 app to freeze. Can an additional write text method be introduced that can be used to write text, that doesn't invoke time.sleep?

Using python 3.5.2.

software PWM for individual LEDs?

Hi - in theory would it be possible simulate PWM for individual LEDs by repeatably drawing to the display at a high rate and determining if this pixel should be on or off for this cycle?

I have been experimenting with code like this - but it runs much too slowly (like 100 times too slow):

c=canvas(device)    #luma.core.render.canvas
    for threshold in range(255,0,-1):
        with c as display:  #ImageDraw
            for x in range(0, 16):
                for y in range(0, 16):
                    if i[x][y]>=threshold:
                        drawPixel(x,y,display)

Any thoughts? Thanks!

David

Error initialising sevensegment

When using the sevensegment class a TypeError occurs:

Traceback (most recent call last):
File "8_digit.py", line 21, in
seg = sevensegment(device)
File "/usr/local/lib/python3.4/dist-packages/luma/led_matrix/device.py", line 123, in init
self.text = ""
File "/usr/local/lib/python3.4/dist-packages/luma/led_matrix/device.py", line 131, in text
self._text_buffer = observable(bytearray(value), observer=self.flush)
TypeError: string argument without an encoding

According to the Python3 documentation, the encoding needs to be added

If it is a string, you must also give the encoding (and optionally, errors) parameters; bytearray() then converts the string to bytes using str.encode().

Orientation wrong on 8x32 module

Hi,

I've got the same problem as is being described over on this arduino forum

This diagram from there neatly illustrates the problem.
Led matrix with wrong orientation

The module looks like this.

8x32 led matrix

I guess I could break it apart and re-orientate it but that seems a little drastic.

Is there a simple workaround for this?

If not I'm happy to try and put together a pull request if you could give me some pointers.

rotate8x8

there's an error in rotate8x8.py when combined with scrolling
simplest repro of this would be taking "Scrolling and pixel setting..." from matrix_test.py and setting device.orientation(180) before running it
source: http://pastebin.com/jzWvuYK7

File "/usr/local/lib/python2.7/dist-packages/max7219/led.py", line 361, in _rotate
tile = rotate(tile)
File "/usr/local/lib/python2.7/dist-packages/max7219/rotate8x8.py", line 37, in rotate
assert 0 <= value < 256, 'Value {0} outside range 0..255'.format(value)
AssertionError: Value 496 outside range 0..255

Add unit tests

Typically simple regression tests to check existing behaviour doesn't break, with mocks where appropriate

Odd behaviour when using luma.ledmatrix on Unicorn 8x8 HAT

Description

The following code works, but get sporadic behaviour - most commonly missed pixels:

import time

from luma.led_matrix.device import neopixel, UNICORN_HAT
from luma.core.render import canvas

device = neopixel(width=8, height=8, mapping=UNICORN_HAT)

for y in range(device.height):
    for x in range(device.width):
        with canvas(device) as draw:
            draw.point((x, y), fill="green")
        time.sleep(0.5)

Any observations and patterns

On launch, the entire HAT will light up briefly. Sometimes it's white/bright colours, sometimes it's a random selection of colours. Green dot begins moving across the display, but after a short while - usually by line #3 or #4 it will start 'jumping' (missing pixels).

Your device type (PiZero / 2B / 3B, etc)

Pi 3B (less than a week old), no mods other than the HAT itself.

OS and kernel version (paste output of uname -a)

Linux ninja 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux

$ cat /etc/*-release

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

No mods other than enabled SPI, disabled boot to Desktop Manager and enabled SSH

Output of dmesg after running the demos

Do you want entire output? Ok to paste in comments?

What amp rating does the power supply provide?

2.5A (https://www.amazon.co.uk/gp/product/B01M03T0UB/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1)

What other peripherals are connected? screen, keyboard, mouse, WIFI, etc?

None - just power and the HAT. Wifi is built-in on Pi 3. Pi is accessed via SSH.

Do you get the same erratic behaviour if you use the official Pimoroni drivers?

No, these work consistently fine.

On the 8x4 Unicorn pHAT, I had to solder the header on - is this the same for the 8x8 HAT? - if so check for any bad solder joints

No, arrived complete and good to go.

launch with php

Hello, i will launch the script by php, with an user "eva" create by me, but when i launch the script, i have :
'''shell
can't open device: Permission denied
'''
when i make : segment = SevenSegment()

Do you have any idea ? or do you know who file i do change the rights ?

Flashing Pixels; Performance Issue?

I think I may be seeing a performance issue. I'm using legacy.text() and draw.point() to light text (the time) plus a few pixels on 4 cascaded matrix displays. When doing this in a simple test script it works great. However, when moving this into my larger script I'm seeing flashing of the pixels I'm lighting individually (legacy.text is solid). Code is below. I can upload a video of the behavior I'm seeing if you'd like.

Thanks for your work here! Other than this flashing issue I've had a really easy time getting up a running. Great examples and documentation.

Type of Raspberry Pi

RPi3

Linux Kernel version

Linux piclock 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux

Expected behaviour

Pixels change to desired state and do not flash in transition or while lit.

Actual behaviour

Seeing pixels flashing either while in transition or while lit.

Here's the code that works in this test script, but causes flashing behavior in my larger script:

#!/usr/bin/env python

from luma.core import legacy
from luma.led_matrix.device import max7219
from luma.core.serial import spi, noop
from luma.core.render import canvas

import datetime, time



# create matrix device
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=4, block_orientation="vertical")

show_dots = True
counter = 1

while True:
    clock_display = (datetime.datetime.now().strftime('%I:%M'))

    if show_dots == True:
        with canvas(device) as draw:
            legacy.text(draw, (0, 0), clock_display, fill="white", font=legacy.font.proportional(legacy.font.SINCLAIR_FONT))
            draw.point([(31, 7), (30, 7), (31, 6)], fill="white")
    elif show_dots == False:
        with canvas(device) as draw:
            legacy.text(draw, (0, 0), clock_display, fill="white", font=legacy.font.proportional(legacy.font.SINCLAIR_FONT))

    time.sleep(.5)
    counter += 1

    if counter == 8:
        show_dots = not show_dots
        counter = 1

AssertionError: Invalid deviceId: 1

Hi

I'm trying to make my own version of the 7-segment modules. The wiring all checks out, however I'm only using 1 4-character 7-segment display - not 2 like the modules have.

I'm trying the sevensegment_test.py file (which works fine on the generic module) and setting the device number to 1 in 'device = led.sevensegment(cascaded=1)', however I'm getting the following error:

AssertionError: Invalid deviceId: 1

I have tried using 0 as a guess, but it then gives me:

AssertionError: Must have at least one device!

I then tried entering 2, which runs the script, but the display shows nothing.

I wanted to check that i'm not doing something wrong with the code, as the wiring looks perfect.

Thanks

Manufactured shield (width 16, height 8) is flipped

I have bought a ready-to-use-shield with a connector for pi, which has the displays in the wrong order, when I use the option --orientation vertical. The rotation is alright. This means it only shows BA instead of AB. Is it possible to switch the order in the library, because i don't want to solder.

Scrolling speed

Is it possible to modify the scrolling speed of the text displayed on these lcds?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.