Physical Pixel Controller

This Max/MSP patch turns on or off an LED attached to an Arduino. Max and the Arduino communicate serially.

To use the patch, copy the text and paste it into a new max patch window.

Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.

Technorati Tags: , ,


max v2;
#N vpatcher 319 365 656 631;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 197 176 100 196617 Converts to integer;
#P window linecount 2;
#P comment 197 112 100 196617 bangs H for on , L for off;
#P window linecount 1;
#P newex 127 112 41 196617 sel 1 0;
#P toggle 127 39 60 0;
#P message 142 136 14 196617 L;
#P newex 127 176 40 196617 atoi;
#P message 127 136 14 196617 H;
#P message 88 176 32 196617 print;
#P newex 127 202 71 196617 serial a 9600;
#P window linecount 2;
#P comment 197 60 100 196617 Click here to turn on or off the LED;
#P comment 14 146 98 196617 Click to get a list of the serial ports;
#P connect 7 0 8 0;
#P connect 8 0 4 0;
#P fasten 6 0 5 0 147 163 132 163;
#P fasten 4 0 5 0 132 163 132 163;
#P fasten 5 0 2 0 132 197 132 197;
#P fasten 3 0 2 0 93 197 132 197;
#P connect 8 1 6 0;
#P pop;

Arduino program:

int outputPin = 13;
int val;

void setup()
{
  Serial.begin(9600);
  pinMode(outputPin, OUTPUT);
}

void loop()
{
  if (Serial.available()) {
    val = Serial.read();
    if (val == 'H') {
      digitalWrite(outputPin, HIGH);
    }
    if (val == 'L') {
      digitalWrite(outputPin, LOW);
    }
  }
}
This entry was posted in arduino/wiring, Max/MSP. Bookmark the permalink.

Comments are closed.