Troubles with 4 servos and 2 dc motors

Hi. I have 4 servos and 2 dc motors (motor shield). For servo i use a program Servo by Dc. I decide to put a motor control to the program..but it doesn't working( Here is my scretch

#include <Servo.h>

// the number of servos in use
#define SERVO_COUNT 10

// the Arduino digital pins the servos are attached to
const byte servoPins[SERVO_COUNT] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4};

Servo servos[SERVO_COUNT];

#include <AFMotor.h>
int moveMotor;
AF_DCMotor motor3(3, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor4(4, MOTOR12_64KHZ); // create motor #3, 64KHz pwm

void setup() {
for (int i=0; i<SERVO_COUNT; i++) {
servos_.attach(servoPins*);_
_ servos.write(90); // arbitrary start position*
* }
Serial.begin(9600);*_

* motor3.setSpeed(255); // set the speed to 200/255*
* motor4.setSpeed(255);*

}
#define STATE_NONE 0
#define STATE_PINNUMBER 1
#define STATE_POSITION 2
static int pinNumber = 0;
static int position = 0;
static int readState = STATE_NONE;
void loop() {
* if ( Serial.available()) {*
* char ch = Serial.read();*

* switch(ch) {*
* case '0'...'9':*
* switch(readState) {*
* case STATE_NONE:
_ break;_
case STATE_PINNUMBER:
_ pinNumber = pinNumber * 10 + (ch -'0');
break;_
case STATE_POSITION:
_ position = position * 10 + (ch -'0');
break;
}
break;
case 'g':
servos[pinNumber].write(position);
pinNumber = 0;
position = 0;_
readState = STATE_NONE;
_ Serial.print("p");
Serial.print(pinNumber);
Serial.print("m");
Serial.print(position, DEC);
Serial.print("OK");
break;
case 'p':_
readState = STATE_PINNUMBER;
_ break;
case 'm':_
readState = STATE_POSITION;
_ break;*_

* }*
* }*
if (Serial.available() > 0) {
* moveMotor = Serial.read();*

* if (moveMotor == 's') { motor3.run(FORWARD); motor4.run(FORWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1085][ch1072][ch1079][ch1072][ch1076]*
* if (moveMotor == 'w') { motor3.run(BACKWARD); motor4.run(BACKWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1074][ch1087][ch1077][ch1088][ch1077][ch1076]*
* if (moveMotor == 'a') { motor3.run(FORWARD); motor4.run(BACKWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1074][ch1087][ch1088][ch1072][ch1074][ch1086]*
* if (moveMotor == 'd') { motor3.run(BACKWARD); motor4.run(FORWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1074][ch1083][ch1077][ch1074][ch1086]*
* }*
}
What i do wrong?

I decide to put a motor control to the program..but it doesn't working

What is happening that you don't want to have happen? What is not happening that you do want to have happen?

servos are working (data on serial port (example)- p1m135g), dc motors, when I press key (w,s,a, or d) only buzzing, not rotate. If I use only
if (Serial.available() > 0) {
moveMotor = Serial.read();

if (moveMotor == 's') { motor3.run(FORWARD); motor4.run(FORWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1085][ch1072][ch1079][ch1072][ch1076]
if (moveMotor == 'w') { motor3.run(BACKWARD); motor4.run(BACKWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1074][ch1087][ch1077][ch1088][ch1077][ch1076]
if (moveMotor == 'a') { motor3.run(FORWARD); motor4.run(BACKWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1074][ch1087][ch1088][ch1072][ch1074][ch1086]
if (moveMotor == 'd') { motor3.run(BACKWARD); motor4.run(FORWARD); delay(17); motor3.run(RELEASE); motor4.run(RELEASE);} // [ch1074][ch1083][ch1077][ch1074][ch1086]
all motors work. May be something with serial port. :-/

You shouldn't be using separate serial reads in your code. Add your motor control code into the first serial read switch/case.

if ( Serial.available()) {
    char ch = Serial.read();

    switch(ch) {
        case '0'...'9':
           switch(readState) {
             case STATE_NONE:
               break;
             case STATE_PINNUMBER:
               pinNumber = pinNumber * 10 + (ch -'0');
               break;
             case STATE_POSITION:
               position = position * 10 + (ch -'0');
               break;
           }
           break;
        case 'g': 
           servos[pinNumber].write(position);
           pinNumber = 0;
           position = 0;
           readState = STATE_NONE;
           Serial.print("p");
           Serial.print(pinNumber);
           Serial.print("m");
           Serial.print(position, DEC);
           Serial.print("OK");
           break;
        case 'p':
           readState = STATE_PINNUMBER;
           break;
        case 'm':
           readState = STATE_POSITION;
           break;
        case 's':
            motor3.run(FORWARD); 
            motor4.run(FORWARD); 
            delay(17); 
            motor3.run(RELEASE); 
            motor4.run(RELEASE);
            break;
        case 'w':
            //motor control code
            break;
        case 'a':
            //motor control code
            break;
        case 'd':
            //motor control code
            break;
    }
 }

I have just used this idea....dc motors are not working, only buzzing, not rotate :cry: