Serial PORT with Arduino

So far i am able to control the speed of 1 OUTPUT connection to a motor,

now i would like to use many PWM OUTPUT pins and be able to have variations of motors on or off including LED lights, is this possible to do?

int input = 0;

void setup() {
// initialize the PWM pin #3 as an output.
pinMode(3, OUTPUT);


void loop() {
input =;
if (input == '(0)'){
analogWrite(3, 0);
Serial.println("Speed is 0!");
if (input == '1'){
analogWrite(3, 64);
Serial.println("Speed is at 25%");
if (input == '2'){
analogWrite(3, 127);
Serial.println("Speed is at 50%");
if (input == '3'){
analogWrite(3, 192);
Serial.println("Speed is at 75%");
if (input == '4'){
Serial.println("Speed is at 100%");

MY Code so far

please bear with me as i am very new to Arduino i hope someone can offer me some advice and point me into the right direction.

thanks in advance


if (input == '(0)'){I don't have one of those on my keyboard, and I'm betting you don't either.

Please remember to use code tags when posting code.

To extend the code to control several different devices you'll need messages that contain something to tell you which device the information is intended for. Have a look at Serial Input Basics for some ideas to get you started.