-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBBC_Wather_MAX7219.py
53 lines (43 loc) · 2.03 KB
/
BBC_Wather_MAX7219.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
#>>>>ozmatox<<<<
import time
import feedparser
from random import randrange
from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.virtual import viewport
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT
#create device
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=4, block_orientation=-90, rotate=0)
#get data
python_wiki_rss_url = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/3088171"
while True:
show_message(device, msg="Aktualna Pogoda dla Miasta Poznan BBC Weather - Forecast", fill="white", font=proportional(SINCLAIR_FONT))
print("Pobieram Dane")
feed = feedparser.parse( python_wiki_rss_url)
for repeats in range(10):
print(repeats)
for items in feed["items"]:
msg = items["title"]
msg = msg[0:msg.find(",")]
print(msg)
show_message(device, msg, fill="white", font=proportional(SINCLAIR_FONT))
time.sleep(1)
#msg = items["link "]
#msg = msg[0:msg.find(",")]
#print(msg)
#show_message(device, msg, fill="white", font=proportional(SINCLAIR_FONT))
#time.sleep(1)
msg = items["description"]
msg = msg[0:msg.find(",,")]
print(msg)
show_message(device, msg, fill="white", font=proportional(SINCLAIR_FONT))
time.sleep(1)
msg = time.asctime()
msg= time.strftime("%H:%M")
print(msg)
show_message(device, msg, fill="white", font=proportional(SINCLAIR_FONT))
time.sleep(10)