Communicating between the Lilypad and Max 5


In order to communicate between the Lilypad and Max 5 you first need to load the Standard Firmata sketch onto the Lilypad. You can find this sketch in Arduino under File > Examples > Firmata > Standard Firmata. Click on upload to upload the Standard Firmata sketch to the board.

Close Arduino.

Now open Max 5 and open the patch called fm.mapping-maxuino.maxpat that is inside the maxuino-bodies folder (you can download this from the Max page).

This patch uses a Max 5 plug in called maxuino to allow communication between Max and the Lilypad.

Connect an analog sensor to one of the Lilypad analog input pins e.g. a0.

Open the Maxuino-Interface patcher in the top (number 1) section of the fm.mapping patch. Turn ON the analog pin that your sensor is connected to (e.g. 0 in the picture below). You should now see the data from your sensor being displayed in the main patcher in the section corresponding to your analog pin. In the picture below the Maxuino-Interface patcher is the top right window and the main fm-mapping patcher is the bottom left window.


maxuino.gif
fm.mapping-maxuino.maxpat with flex sensor data being input via a0
You can now connect the corresponding Analog receive output to one of the video effects e.g. Analog 0 to Framerate as in the picture below. Your sensor will now control the framerate of the video playback.

analogToFramerate.gif
Connecting Analog 0 input to Video Framerate


Note: If you are trying this at home with a demo copy of Max 5 you will first need to download and install the maxuino plug in and a couple of other components in order for it to work. Instructions for doing that are here: http://www.maxuino.org/?p=58#more-58

In simple steps the process is:
1. Download Maxuino 009 and place the whole maxuino-009 folder inside the Cycling 74 folder inside the MAX 5 application folder ( http://www.maxuino.org/wp-content/uploads/2010/04/maxuino-009.zip ).
2. Download the CNMAT max patches and place the whole CNMAT folder inside the Cycling 74 folder inside the MAX application folder ( http://cnmat.berkeley.edu/files/maxdl/ALL/CNMAT-Everything-OSX-MachO.tar.gz ). You can rename the CNMAT folder if you like.
3. If you haven't already then download version 0018 of Arduino and drag the application to the application folder (replace old version) - (http://arduino.googlecode.com/files/arduino-0018.dmg ).
4. Download the latest version of Firmata ( http://maxuino.org/wp-content/uploads/2010/02/firmata.tar.gz ). Place this inside the Resources folder of the Arduino application by opening the application package (right-click on application - choose Show Package Contents) and then replacing the existing Firmata folder at the following location with the new one - Applications/Arduino.app/Contents/Resources/Java/libraries/Firmata .


Triggering with Analog Inputs

To use the values from the analog inputs on the lilypad as a trigger, set up the following in the fm.mapping patch:


Screen_shot_2010-09-20_at_1.09.04_PM.png

Change the "r /Analog/0" to be which ever you have connected the switch to.

Change the "read movie4.mov" and "read movie1.mov" to your movie file name.

Change the "s topleft" or "s topright" to the movie layer you want to work with.

Setting up for performance

When you want to resize the window to fill the screen check out this performance setup tutorial:
Jitter Tutorial 38


This piece of code let's you trigger 3 movies blended on the alpha chanel and xfaded for the third movie. This option will work best if you use movies with the same background colour.

Screen_shot_2010-09-20_at_4.23.02_PM.png

See below using the included content. Depending on which order you choose to alpha blend the movies, you will have differing results, as can be see below on the left (where movie1 was chosen first) and the right (where movie3 was chosen first). You will also get better results if you have more suitable content, which has larger black or white areas.

Screen_shot_2010-09-20_at_4.43.37_PM.png



You can blend the white or black channel by changing the inverse from a 1 to a 0.


you can also have multiple blends, putting one output into the right inptu of another, like this:Screen_shot_2010-09-20_at_4.51.08_PM.png