controlling led lights from max msp via an arduino


I have the following question:

How do I control rgb values of two LED lights that are hooked up to an arduino?

1) which arduino to use? 2) which arduino tutorial to do first to get the necessary knowledge? 3) how to use the serial object in max to send rgb data to the arduino?

Thanks for your help and advice!


You connect the inputs of the led to the PWM channels of the Arduino.

  1. The UNO has 6 PWM channels. Should be enough for your RGB leds.
  2. A simple search in google turned up these results:

  1. Not sure what you mean by max, but if you plan to send the RGB value to the Arduino you’ll have to find a protocol to send 3 bytes for the RGB values. For example:
unsigned char Red=0, Green=0, Blue = 0;
if(Serial.Available() > 4) {//you'll send a string beginning.

if (Serial.Read() == 'S') { //S from Start
    Red = Serial.Read(); 
    Green = Serial.Read(); 
    Blue = Serial.Read();

analogWrite(pinRed, Red); 
analogWrite(pinGreen, Green);
analogWrite(pinBlue, Blue); 

Mind you that this program does not work with ASCII transmission. So you might need to find a program that sends numerical values over the serial port. The Arduino IDE doesn’t do that.

If you need to send ASCII, have a look at the atoi() function and adapt the code I wrote.