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:
-
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).
-
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.