I want my arduino to recieve a serial message and run different commands based on the contents of the serial recieved. For example, if it recieved "r122" is would AnalogWrite (r, 122). If it recieved "r155" is would AnalogWrite(r, 155)... b130 = AnalogWrite(b, 130) etc.
Alternatively, it could recieve one message saying the next message should be applied to a certain pin.
How should I go about this?