DFRobot DFR0004 Manual - Page 10

Browse online or download pdf Manual for Controller DFRobot DFR0004. DFRobot DFR0004 11 pages. Dfrduino romeo-all in one controller
Also for DFRobot DFR0004: Manual (13 pages), Manual (16 pages)

DFRobot DFR0004 Manual
//Standard DLL Speed control
int E1 = 4;     //M1 Speed Control
int E2 = 7;     //M2 Speed Control
int M1 = 5;    //M1 Direction Control
int M2 = 6;    //M1 Direction Control
//When m1p/m2p is 127, it stops the motor
//when m1p/m2p is 255, it gives the maximum speed for one direction
//When m1p/m2p is 0, it gives the maximum speed for reverse direction
void DriveMotorP(byte m1p, byte m2p)//Drive Motor Power Mode
{
  digitalWrite(E1, HIGH);
  analogWrite(M1, (m1p)); 
  digitalWrite(E2, HIGH);
  analogWrite(M2, (m2p)); 
}
  int i;
  for(i=6;i<=9;i++)
    pinMode(i, OUTPUT);  
    {
      switch(val)
      {
        DriveMotorP(0xff,0xff); // Max speed
        break;
      case 'x'://Move Backward
        DriveMotorP(0x00,0x00);
        ; // Max speed
        break;
      case 's'://Stop
        DriveMotorP(0x7f,0x7f);
        break;       
      }
    }
  }
}

Schematics

schematic (http://www.dfrobot.com/image/data/DFR0004/RoMeo%20V1.1%20sch.pdf)
Romeo Schematic V1.0
(http://www.dfrobot.com/image/data/DFR0004/RoMeo_Schematic_V1.pdf)
Romeo Schematic V0.9 (http://www.dfrobot.com/wiki/images/a/a0/RoMeo_Schematic.png)