-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiday
executable file
·37 lines (31 loc) · 912 Bytes
/
piday
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
#!/usr/bin/python
from fc_lib import *
import signal
import os
import opc
import sys
import time
pid = str(os.getpid())
pidfile = "/var/run/piday.pid"
if os.path.isfile(pidfile):
print "%s already exists, exiting" % pidfile
sys.exit()
else:
file(pidfile, 'w').write(pid)
def set_exit_handler(func):
signal.signal(signal.SIGTERM, func)
def on_exit(sig, func=None):
print "exit handler triggered"
sys.exit(1)
if __name__ == '__main__':
set_exit_handler(on_exit)
client = opc.Client('localhost:7890')
paths = ['/home/pi/fadecandy_shenanigans/piday_images/piday_w.png',
'/home/pi/fadecandy_shenanigans/piday_images/piday_w.png',]
images = [read_image_to_array(path) for path in paths]
images = images
while True:
for image in images:
client.put_pixels(image)
client.put_pixels(image)
time.sleep(0.01)