using serial input to independently control three PWM pins

what's up all, this is my first post here in the forum.

I want to pass a stream of serial signals from max/msp to the arduino that will independently set the values of three PWM pins. I'm not sure how to best to route the signal to one pin or another. So this is sort of a conceptual thing about how to accomplish this programming task. I've thought about two possible ways to do it:

  1. split up the signal from max numerically into three ranges (say, 0-74, 75-149, 150-225). Use if-then statements to assign each of these ranges to one of the pins and then scale the numeric range appropriately (i.e. scale 0-74 to 0-255 going to the first PWM pin, scale 75-149 to 0-255 going to the second PWM pin, etc).

  2. send pairs of numbers from max, with a routing ID followed by the desired value -- so, "1 230" would set the first pwm pin to 230, and "3 128" would set the 3rd PWM pin to 128. This would be a higher resolution result. The problem here is that i don't know to set up the arduino code to accomplish this kind of routing.

If you have any advice or other ideas about how to achieve this, i would appreciate your thoughts.

Why are you wanting to limit the dynamic range of your output?
Why not have full eight bit range for each channel?

I'd like to preserve the full dynamic range. How do you recommend tackling this?

i guess I can just use method #1 and use like 0-255 for the first pin, 300-555 for the second pin, and 600-855 for the third pin?

Yes, you could, but that would imply sending two bytes instead of just one.
This sort of thing comes up every other day here - try searching the forum