This tutorial explains how to realize a responsive remote control with an iPhone or iPad using TouchOSC App.

Install pyOSC on CORE9G25

pyOSC is a a simple OpenSoundControl implementation in Python providing support for OSC-bundles, a simple OSC-client, a simple OSC-server, threading & forking OSC-servers.

To install pyOSC type:

~# git clone git://github.com/tanzilli/pyOSC
~# cd pyOSC/
~/pyOSC# python setup.py install

Install and configure TouchOSC on your iPhone

Download from the Apple store TouchOSC and run it.

Control a led module:

The following python example shows how to control some GPIO lines from touchOS. We use a the system led module On the CORE9G25.

Run this program an CORE9G25:

  • tapled.py:  Postition: CD://Debian/playgroud/python/touchosc/tapled.py
    from ablib import Daisy11
    from OSC import OSCServer,OSCClient, OSCMessage
    from time import sleep
    import types
    
    L1=Daisy11("D11","L1")
    L2=Daisy11("D11","L2")
    L3=Daisy11("D11","L3")
    L4=Daisy11("D11","L4")
    L5=Daisy11("D11","L5")
    L6=Daisy11("D11","L6")
    L7=Daisy11("D11","L7")
    L8=Daisy11("D11","L8")
    
    server = OSCServer(("0.0.0.0", 8000))
    
    def push1_callback(path, tags, args, source):
    	if path=="/7/push1":
    	    if args[0]==1.0:
    	        L1.on()
    	    else:
    	        L1.off()
    
    def push2_callback(path, tags, args, source):
    	if path=="/7/push2":
    	    if args[0]==1.0:
    	        L2.on()
    	    else:
    	        L2.off()
    
    def push3_callback(path, tags, args, source):
    	if path=="/7/push3":
    	    if args[0]==1.0:
    	        L3.on()
    	    else:
    	        L3.off()
    
    def push4_callback(path, tags, args, source):
    	if path=="/7/push4":
    	    if args[0]==1.0:
    	        L4.on()
    	    else:
    	        L4.off()
    
    def push5_callback(path, tags, args, source):
    	if path=="/7/push5":
    	    if args[0]==1.0:
    	        L5.on()
    	    else:
    	        L5.off()
    
    def push6_callback(path, tags, args, source):
    	if path=="/7/push6":
    	    if args[0]==1.0:
    	        L6.on()
    	    else:
    	        L6.off()
    
    def push7_callback(path, tags, args, source):
    	if path=="/7/push7":
    	    if args[0]==1.0:
    	        L7.on()
    	    else:
    	        L7.off()
    
    def push8_callback(path, tags, args, source):
    	if path=="/7/push8":
    	    if args[0]==1.0:
    	        L8.on()
    	    else:
    	        L8.off()
    
    def handle_error(self,request,client_address):
        pass
    
    server.addMsgHandler( "/7/push1",push1_callback)
    server.addMsgHandler( "/7/push2",push2_callback)
    server.addMsgHandler( "/7/push3",push3_callback)
    server.addMsgHandler( "/7/push4",push4_callback)
    server.addMsgHandler( "/7/push5",push5_callback)
    server.addMsgHandler( "/7/push6",push6_callback)
    server.addMsgHandler( "/7/push7",push7_callback)
    server.addMsgHandler( "/7/push8",push8_callback)
    
    
    server.handle_error = types.MethodType(handle_error, server)
    
    while True:
    	server.handle_request()
    
    server.close()
    

On the iPhone open the TouchOSC app configuration, then the CONNECTIONS-->OSC screen and fill the Host field with the CORE9G25 IP address.

From the LAYOUT section select LiveControl then press Done.

Inside the TouchOSC panel select tha Pads tab then touch some buttons.

Related links

关注我们: 微博

销售邮箱:market@armdevs.com
技术支持: support@armdevs.com
销售电话: +86-755-29638421


核风在线支持>
在线时间:09:00-18:00
Copyright @ 2014 to 2020 - 核风智能技术有限公司