Guide to the Sample Code

Python Examples

Sample Python code for controlling hardware and choreographing performances can be found in the Python folder. These scripts use Python 3 with a few additional packages as described in System Requirements.

Brief descriptions of the examples:

  • valves1.py GUI interface for mapping events from MPD218 drum pad to pneumatic valve commands.

Running the Python Samples on an IDeATe macOS Laptop

This still needs to be updated for 2020, the IDeATe MBP are using an updated system.

The IDeATe MacBook Pro laptops have several different Python systems installed, so running the sample code requires a little care. The following example is based on the sim2.zip package; running other samples will be similar.

  1. First, download the package (e.g. sim2.zip) to whatever location is convenient (e.g. Desktop or Downloads).

  2. Double-clicking on the zip file under macOS will unpack it to a new folder named sim2.

  3. Within the new sim2 folder is a sim2.py script file and a kf folder which contains the library modules.

  4. Double-clicking on the sim2.py script will not run it, but will instead open it in some version of the IDLE Python editor.

  5. Right-clicking or control-clicking on it will bring up a context menu. Within that menu is the Open With submenu. Please select Python Launcher (3.5.4).

  6. The first launch will probably fail. Please bring up the Python Launcher application and open its Preferences pane. For Interpreter, please enter /opt/local/bin/python3.5. This is the specific interpreter which includes the libraries required by the course software.

  7. Subsequent launches using Open With/Python Launcher should work.

The alternative approach is to launch the Terminal command line. E.g., if the package was unpacked on the Desktop, the following Terminal commands would launch sim2:

cd
cd Desktop/sim2
/opt/local/bin/python3.5 sim2.py

Currently, IDLE 3.5 is not working, but in the future we hope to make it possible to launch the sample code directly from the editor.

Arduino Sketches

The ValveControl Arduino Sketch runs on the pneumatic valve controller. The sketch controls four pairs of fill-empty pneumatic valves.

The StepperWinch Arduino Sketch runs on the stepper-based capstan winch controller. Thes sketch controls four stepper motors as capstan drives for moving control lines. It receives control messages from an external source over a USB serial port. The protocol is event-driven with local filtering and motion smoothing, much like a MIDI instrument driven by note events.