-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbarometer.py
95 lines (86 loc) · 1.97 KB
/
barometer.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from sense_hat import SenseHat
sense = SenseHat()
import time
barrometer = False
Z = (0, 0, 0)
Y = (255, 214, 0)
y = (255, 255, 0)
G = (48, 48, 64)
B = (0, 0, 255)
W = (255, 255, 255)
donderwolk = [
Z, Z, Z, G, G, Z, Z, Z,
Z, Z, G, G, G, Z, Z, Z,
Z, G, G, G, G, G, Z, Z,
Z, G, G, Y, G, G, G, Z,
G, G, G, G, Y, G, G, G,
Z, G, G, Y, Y, G, G, Z,
Z, Z, Z, Y, Z, Z, Z, Z,
Z, Z, Z, Z, Y, Z, Z, Z
]
regen = [
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, G, G, Z, Z, Z,
Z, Z, G, G, G, G, G, Z,
Z, G, G, G, G, G, G, Z,
Z, G, G, G, G, G, G, Z,
Z, Z, Z, Z, B, Z, Z, Z,
Z, Z, B, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, B, Z, Z
]
bewolkt = [
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, G, G, Z, Z, Z,
Z, Z, G, G, G, G, G, Z,
Z, G, G, G, G, G, G, Z,
Z, G, G, G, G, G, G, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z
]
normaal = [
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, W, W, Z, Z, Z,
Z, Z, W, W, W, W, W, Z,
Z, W, W, W, W, W, W, Z,
Z, W, W, W, W, W, W, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z
]
zon = [
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, W, W, Z, Z, Z,
Z, Z, W, W, W, y, y, Z,
Z, W, W, W, W, y, y, Z,
Z, W, W, W, W, W, W, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z
]
zonnig = [
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, y, y, Z, Z,
Z, Z, Z, y, y, y, y, Z,
Z, Z, Z, y, y, y, y, Z,
Z, Z, Z, Z, y, y, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z,
Z, Z, Z, Z, Z, Z, Z, Z
]
def luchtdruktonen():
p = sense.get_pressure()
p = round (p , 1)
p = int(p)
if p < 976 :
pixels = donderwolk
elif p < 992 :
pixels = regen
elif p < 1009 :
pixels = normaal
elif p < 1026 :
pixels = zon
else:
pixels = zonnig
sense.set_rotation(180)
sense.set_pixels(pixels)