def __init__(self, modules, refresh_rate=REFRESH_RATE, debug=False): self.hosts = Hosts() self.refresh_rate = refresh_rate self.debug = debug self.modules = [(m, Client('{}.local:{}'.format(m.hostname, OPC_PORT))) for m in modules] self.active = True self.time_taken = 0.0 self.i = 0 self.update()
def main(): client = Client('localhost:7890') while True: print('Updating... ', end="") positions = get_vehicle_positions() print("done") print("inbound... ") update(client, positions, "Inbound", 10) print("outbound... ") update(client, positions, "Outbound", 10)
def __init__(self): self._client = Client('localhost:7890') self._scenes = [ SpritesScene(), MandelScene(), FunctionScene(), FunctionScene2(), SquaresScene(), ] self._timer = Timer(self._switch) self._timer.set_period(10.0) self._switch()
def __init__(self): print 'Initializing Driver' session = Session() self.modules = session.query(LightModule).all() self.strips = {s.name: s for s in session.query(Strip).all()} session.close() print 'starting engine' self.engine = LightEngine(self.modules) print 'engine running' self.sp = Spotify() print 'spotify loaded' if SIM: self.sim = Client('127.0.0.1:7890')
#!/usr/bin/env python # Open Pixel Control client: All lights to solid white import time from opc import Client numLEDs = 47 client = Client('192.168.1.73:7890') black = [(0, 0, 0, 0)] * numLEDs white = [(255, 0, 0, 0)] * numLEDs while True: client.put_pixels(white) time.sleep(3.05) client.put_pixels(black) time.sleep(3.05)
''' example patter ''' from bits import Bit from color import hsv_to_rgb, HSV, rgb_to_hsv, RGB, Color from grid import Grid from projector import Projector from random import randint, sample, choice from itertools import count from time import sleep from opc import Client client = Client('localhost:7890') __all__ = [ 'RGB_CODES', 'HUES_primaries', 'create_random', 'spreaders', 'rainbow_test' ] numLEDs = 40 RGB_CODES = dict(black=(0, 0, 0), red=(255, 0, 0), orange=(255, 128, 0), yellow=(255, 255, 0), pink=(255, 0, 128), purple=(255, 0, 255), lavendar=(128, 0, 255), green=(0, 255, 0), lime=(128, 255, 0), emerald=(0, 255, 128), turq=(128, 255, 128), blue=(0, 0, 255), cyan=(0, 255, 255),
def __init__(self, hostname): self.hostname = hostname self.client = Client('{}.local:{}'.format(self.hostname, OPC_PORT))
def main(): client = Client('localhost:7890') while True: loop(client)