vladnt wrote: ↑Wed Jan 31, 2018 9:46 am
Комменть строку
это для старой библиотеки
Не чего не получается
Code: Select all
#!/usr/bin/env python
import os, time, sys
import multiprocessing
from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.legacy import text, show_message
from luma.core.legacy.font import LCD_FONT, proportional
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=4, block_orientation=-90)
while(True):
clock = time.strftime("%H%M")
seconds = int(time.strftime("%S"))
month = time.strftime(" %m")
day = time.strftime(" %d")
year = time.strftime("%Y")
for n, c in enumerate(clock):
device.letter(n, ord(c))
if seconds == 59 :
for row in range(8):
device.scroll_up()
time.sleep(0.1)
for n, c in enumerate(month):
device.letter(n, ord(c))
time.sleep(1)
for row in range(8):
device.scroll_down()
time.sleep(0.1)
for n, c in enumerate(day):
device.letter(n, ord(c))
time.sleep(1)
for row in range(8):
device.scroll_down()
time.sleep(0.1)
for n, c in enumerate(year):
device.letter(n, ord(c))
time.sleep(1)
for row in range(8):
device.scroll_down()
time.sleep(0.1)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
pass
Code: Select all
>>> %Debug timedate.py
Traceback (most recent call last):
File "C:\Users\viktor\Downloads\timedate.py", line 6, in <module>
from luma.led_matrix.device import max7219
ModuleNotFoundError: No module named 'luma'
>>>
в терменале вот что
Code: Select all
pi@raspberrypi:~ $ sudo python test.py
Traceback (most recent call last):
File "test.py", line 22, in <module>
device.letter(n, ord(c))
AttributeError: 'max7219' object has no attribute 'letter'
pi@raspberrypi:~ $