Control PWM over Serial

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

When you have received the value and stored it in a variable you can then use analogWrite() to produce the PWM signal using that value.

...R