arduino/max/msp?

whataniceguitar's icon

hey everyone---

i've been having issues figuring out how to control red, green, blue and white LEDs with Max using an arduino. I need to be able to control the brightness of the LEDs, not just on/off values. Anyone have any suggestions? I've been using a modification of "simple message system" (http://www.arduino.cc/playground/Code/SimpleMessageSystem) that uses keystrokes as toggle switches for the LEDs.

Included is the arduino code, my patch, and the max externals necessary for running the now modified "simple message system".

p.s. i'm also having some problems with the LEDs themselves - when i try and turn all 4 on simultaneously, the arduino seems to get a little overloaded and some don't turn off when i release the keys (some don't turn on as well).

thanks a lot everyone!!!

1337.prject.zip
zip
guylevans's icon

Hi there,
I've been using RGB LED's with an Arduino/Max for the past few months.

I would highly recommend you trying out Maxuino for Max

.
It allows for easy communication between Max and arduino.
I'm using Maxuino v7, but you can also try v8 or v9.

Just upload Firmata v2.1 onto your arduino, then load the maxuino test patch.
You can easily integrate the arduino digital inputs/outputs and PWM outputs/Analog inputs with Max/Msp.

If you want to fade the LED's then you will need to use PWM (pulse width modulation) outputs on your arduino.
If you use digital outputs, the arduino simply toggles between Red (on/off), Green (on/off) and Blue (on/off)

You need 3 arduino channels of PWM (for 'each' RGB LED), but there are ways of increasing your available PWM channels (search the arduino forum for TLC5940).

If your using normal LEDS though, just one PWM channel is needed per LED.

Hope that helps, good luck with your project.