Forums > MaxMSP

How to Control Multiple LEDs on the Arduino Using MAX MSP?

May 27, 2012 | 8:10 am

Hi, I have to create an interactive installation and what I want to do is to control the blinking of multiple LEDs through motion sensor.

I was able to make one LED blink in MAX by copying the code from arduino PhsyicalPixel, which allows me to control one LED to blink.

I have tried to modify the code to allow multiple LEDs but it doesn’t seem to work, except for just one LED. Is it possible to control multiple LEDs on the arduino through MAX? If so I need help with the code please. I have checked the other posts, and it doesn’t seem to answer whether or not I can control multiple LEDs and how (what code) to do it.

here is the arduino code i copied

const int ledPin = 13; // the pin that the LED is attached to
int incomingByte; // a variable to read incoming serial data into

void setup() {
// initialize serial communication:
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
}

void loop() {
// see if there’s incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// if it’s a capital H (ASCII 72), turn on the LED:
if (incomingByte == ‘H’) {
digitalWrite(ledPin, HIGH);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘L’) {
digitalWrite(ledPin, LOW);
}
}
}

here is the max code i copied

(`)

– Pasted Max Patch, click to expand. –

(`)


May 27, 2012 | 9:41 am

Using the search option (top right) I found this:

http://cycling74.com/forums/topic.php?id=39416

questions are rarely unique


Viewing 2 posts - 1 through 2 (of 2 total)