Serial Arduino com

Hi guys!

I triying to make a simple comunication Arduino<–>OF

I would like to send an identifier and data to Arduino
send for example ‘a’ to recieve analogRead from the Arduino
and ‘b’ to change the PWM (int) value in one of the Arduino PWM pins.

something like this:


(I know this is wrong… just get the idea)

in the other hand the arduino will have something like this:

ID =  
switch (ID){  
      case 'a':  
      case 'b': ;  
        int pwm = map(,0,100,0,255);    

I know this is all wrong so think it as an idea…

How can I send those ID and string (or Int) to an Arduino? I can’t use firmata…