Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from fc_lib import *
- import signal
- import os
- import opc
- import sys
- import time
- #import cv2
- pid = str(os.getpid())
- pidfile = "/var/run/mario.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/mario_images/mario2.jpg',
- '/home/pi/fadecandy_shenanigans/mario_images/mario3.jpg',
- '/home/pi/fadecandy_shenanigans/mario_images/mario1.jpg']
- 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.11)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement