// 1 DC motor

void setup() { 
pinMode(7, OUTPUT) ;
pinMode(8, OUTPUT) ;
pinMode(9, OUTPUT) ;  // Speed contorl pin
}

void loop() {
 
// one direction
   digitalWrite(7, HIGH) ;
   digitalWrite(8, LOW) ;
   analogWrite(9, 250) ;   // Speed
   delay(3000) ;
 
 // opposite direction
   digitalWrite(7, LOW) ;
   digitalWrite(8, HIGH) ;   
   analogWrite(9, 150) ;   // Speed 
   delay(3000) ; 
   
 // stop
   digitalWrite(7, LOW) ;
   digitalWrite(8, LOW) ; 
   delay(3000) ;         
}