Sections
You are here: Home Documentation How-tos Get Started with Python

Get Started with Python

A quick overview on using the Make Controller with Python over Ethernet via OSC.

Purpose

To integrate the Make Controller into a project written in Python.

 

Python Icon

 

Prerequisities

  • You are familiar with, or willing to learn, Python
  • You have a working network setup with your Make Controller.  You'll need to know the IP address of your Make Controller, so make sure you can see this using mchelper.
  • A text editor (or simple IDE) and familiarity at the command line.  We'll be editing a python script and executing it from the command line.

Step by step

We're going to use the simpleOSC Python library to build our test project - download it at the bottom of this page.  This copy of simpleosc contains a template that has been adjusted for the Make Controller, but is otherwise unmodified from the stock simpleOSC distribution.  Open up appTemplate.py in your editor.  This is our simple example that also serves as a good base to start tweaking for your specific project.

On OS X, I was able to simply navigate to the simpleOSC download and run

python appTemplate.py

but you may need to install simpleOSC on your system.  See the readme for details on how to do this.

The only change you need to make is to update the send_address variable to the IP address of your Make Controller, as reported by mchelper.

Binding Addresses

One concept to go over is binding addresses.  The way that receiving messages in simpleOSC works is that you register for the messages that you're interested in by specifying a method that will be called when the message is received. 

In our example, we've bound the OSC address /analogin/7/value with a method called onAnalogIn7.  Now any time we get a message back that starts with /analogin/7/value, onAnaloginIn7 will be called with that message.  Unfortunately, simpleOSC doesn't seem to support registering for address patterns, such as /analogin/*/value or partial addresses such as /analogin/.  simpleOSC will also print out messages to let you know about messages it received that you didn't register for.

Sending and Receiving

Other than that, the examples are pretty self explanatory for sending and receiving messages and bundles.  Incoming bundles are always unpacked internally, so you only ever get single messages.  Explore the Make Controller OSC system below and try experimenting with controlling different parts of the board.  That's it!

Further information

Attached files
Log in


Forgot your password?
New user?