Exemple #1
0
 def led_all(self, s):
     path = '/m40h-001/grid/led/all'
     print("sending: ", path, s)
     asyncio. async (aiosc.send(('127.0.0.1', 8000), path, s))
     path = '/m40h-002/grid/led/all'
     print("sending: ", path, s)
     asyncio. async (aiosc.send(('127.0.0.1', 8001), path, s))
Exemple #2
0
 def led_set(self, x, y, s):
     #translate grid_key from spanned grid coords to device grid coords
     if x < 8:
         x = abs(7 - x)
         print("sending /mh40h-001/grid/led/set", x, y, s)
         path = '/m40h-001/grid/led/set'
         asyncio. async (aiosc.send(('127.0.0.1', 8000), path, x, y, s))
     else:
         r = y
         y = abs(x - 8)
         x = r
         print("sending /m40h-002/grid/key ", x, y, s)
         path = '/m40h-002/grid/led/set'
         asyncio. async (aiosc.send(('127.0.0.1', 8001), path, x, y, s))
Exemple #3
0
 def led_set(self, x, y, s):
     #translate grid_key from spanned grid coords to device grid coords
     #TODO: use the destination ports defined in the config file instead of hardcoding
     if x < 8:
         x = abs(7 - x)
         #print("sending /mh40h-001/grid/led/set", x,y,s)
         path = '/m40h-001/grid/led/set'
         asyncio. async (aiosc.send(('127.0.0.1', 8000), path, x, y, s))
     else:
         r = y
         y = abs(x - 8)
         x = r
         #print("sending /m40h-002/grid/key ", x,y,s)
         path = '/m40h-002/grid/led/set'
         asyncio. async (aiosc.send(('127.0.0.1', 8001), path, x, y, s))
Exemple #4
0
 def led_map(self, x_offset, y_offset, data):
     # send the data to the relevant subgrid, depending on the x offset -
     if x_offset == 0:
         #rotate 180
         rotated1 = list(zip(*data[::-1]))
         rotated2 = list(zip(*rotated1[::-1]))
         args = [pack_row(rotated2[i]) for i in range(8)]
         #self.send('/{}/grid/led/map'.format(self.prefix), x_offset, y_offset, *args)
         path = '/m40h-001/grid/led/map'
         asyncio. async (aiosc.send(('127.0.0.1', 8000), path, x_offset,
                                    y_offset, *args))
         #print(path,x_offset, y_offset,args)
     else:
         #set the x_offset to 0 for the rightmost grid
         rotated1 = list(zip(*data[::-1]))
         #rotated2 = list(zip(*rotated1[::-1]))
         #rotated3 = list(zip(*rotated2[::-1]))
         args = [pack_row(rotated1[i]) for i in range(8)]
         path = '/m40h-002/grid/led/map'
         asyncio. async (aiosc.send(('127.0.0.1', 8001), path, 0, y_offset,
                                    *args))
Exemple #5
0
#! /usr/bin/env python3

import asyncio
import aiosc

loop = asyncio.get_event_loop()
loop.run_until_complete(
    #aiosc.send(('127.0.0.1', 8001), '/m40h-002/grid/led/set', 0, 0, 1)
    #sleep(10)
    aiosc.send(('127.0.0.1', 8001), '/m40h-002/grid/led/set', 0, 0, 0)
)
Exemple #6
0
#! /usr/bin/env python3

import asyncio
import aiosc

loop = asyncio.get_event_loop()
loop.run_until_complete(
    aiosc.send(('127.0.0.1', 9000), '/hello', 'world')
)
# https://github.com/artfwo/aiosc

import asyncio
import aiosc

#''' sending works
touchOSC_ip = '10.0.0.30'
touchOSC_port = 9000
osc_command = 'pan_tilt_speed_label'
osc_argument = 5

loop = asyncio.get_event_loop()
#loop.run_until_complete(aiosc.send((touchOSC_ip, touchOSC_port), '/1/pan_tilt_speed', 5))
#loop.run_until_complete(aiosc.send((touchOSC_ip, touchOSC_port), '/1/'+osc_command, osc_argument))
loop.run_until_complete(
    aiosc.send(('10.0.0.201', 9000), '/ch/01/mix/fader', 0.5))
#'''
print('complete')
''' server works
def print_message(addr, path, args):
    if args[0] == 1.0:
        print(path)
    #print(args[0])


# OSC receiving server
def protocol_factory():
    osc = aiosc.OSCProtocol({'//*': lambda addr, path, *args: print_message(addr, path, args)})
    return osc

loop = asyncio.get_event_loop()
Exemple #8
0
#! /usr/bin/env python3

import asyncio
import aiosc

loop = asyncio.get_event_loop()
loop.run_until_complete(aiosc.send(('127.0.0.1', 9000), '/hello', 'world'))