problem with wifi shield and motor shield

Hello, after using the help of the members of this forum I have succed to control
two engine with wifi card (arduino wifi shield http://arduino.cc/en/Main/ArduinoWiFiShield) and
the motor card (arduino motor shield http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/?ALLSTEPS) but the problem in pin 9 since it is reserved for wifi card so it presents an error
who can help me ,for exemple I can change the motor 2 to
work with another pin or anything, I need your help
this is my arduino code

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "mon reseau wifi"; // your network SSID (name)
char pass[] = "mon mot de passe"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  Serial.begin(9600); // initialize serial communication
  pinMode(22, OUTPUT);
  ////
  pinMode(12, OUTPUT); 
  pinMode(13, OUTPUT); 
  //establish motor brake pins
  pinMode(9, OUTPUT); 
  pinMode(8, OUTPUT); 
  //Turns brake off for drive motor
  digitalWrite(9, HIGH); 
  digitalWrite(8, HIGH); 
//

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    while (true); // don't continue
  }

  String fv = WiFi.firmwareVersion();
  if ( fv != "1.1.0" )
    Serial.println("Please upgrade the firmware");

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid); // print the network name (SSID);

    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
    delay(10000);
  }
  server.begin(); // start the web server on port 80
  printWifiStatus(); // you're connected now, so print out the status
}


void loop() {
  WiFiClient client = server.available(); // listen for incoming clients

  if (client) { // if you get a client,
    Serial.println("new client"); // print a message out the serial port
    String currentLine = ""; // make a String to hold incoming data from the client
    while (client.connected()) { // loop while the client's connected
      if (client.available()) { // if there's bytes to read from the client,
         char c = client.read(); // read a byte, then
         Serial.write(c); // print it out the serial monitor
         if (c == '\n') { // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
           // the content of the HTTP response follows the header:
client.print("<a href=\"/F\">AVANT</a>
");
client.print("<a href=\"/B\">ARRIERE</a>
");
client.print("<a href=\"/D\">DROITE</a>
");
client.print("<a href=\"/G\">GAUCHE</a>
");
client.print("<a href=\"/A\">ARRET</a>
");
client.print("<a href=\"/N\">MODE NUIT</a>
");
client.print("<a href=\"/J\">MODE JOUR</a>
");

            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          }
          else { // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        }
        else if (c != '\r') { // if you got anything else but a carriage return character,
          currentLine += c; // add it to the end of the currentLine
        }
        // Check the client request 
        if (currentLine.endsWith("GET /F")) {
          digitalWrite(12, HIGH); 
          digitalWrite(13, HIGH);
          digitalWrite(9, LOW); 
          digitalWrite(8, LOW); 
           analogWrite(3, 200);
           analogWrite(11, 200);
        }
        if (currentLine.endsWith("GET /A")) {
           digitalWrite(9, HIGH); 
           digitalWrite(8, HIGH);
        }
         if (currentLine.endsWith("GET /B")) {
           digitalWrite(12, LOW); 
           digitalWrite(13, LOW);
           digitalWrite(9, LOW); 
           digitalWrite(8, LOW);
            analogWrite(3, 123);
            analogWrite(11, 123);
        }
        if (currentLine.endsWith("GET /D")) {
           digitalWrite(12, HIGH); 
           digitalWrite(13, LOW);
           digitalWrite(9, LOW); 
           digitalWrite(8, LOW);
            analogWrite(3, 123);
            analogWrite(11, 200);  
        }
        if (currentLine.endsWith("GET /G")) {
           digitalWrite(12, LOW); 
           digitalWrite(13, HIGH);
           digitalWrite(9, LOW); 
           digitalWrite(8, LOW);
            analogWrite(11, 123);
            analogWrite(3, 200);                   
        }
        if (currentLine.endsWith("GET /N")) {
          digitalWrite(22, HIGH);
        } 
        if (currentLine.endsWith("GET /J")) {
          digitalWrite(22, LOW);
        } 
      }
    }
    // close the connection:
   client.stop();
   Serial.println("client disonnected");
  }
}

void printWifiStatus() {
  
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
  
  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}

no one can give me any idea :roll_eyes:

Your question doesn't read very well, because some errors seem to have occurred during translation from French-ish to English.

You can't do what you are asking for without making hardware changes.
First you need to make sure you know exactly what pins are needed by both shields.
It seems you already found pin 9 is used by both, are there any other pins that are claimed by both ?
Then you need to find an Arduino pin that is not used by any of the shields, and that can be used as an alternative.
Once you know that, you need to decide what board you will modify.

This would be a hardware modification, you would need to reroute that pin 9 to another pin.
Simplest way to do that is by cutting the pin off the shield, provided it is the shield on top that you are going to modify.
You could also try to bend the pin away, but you'll probably break it while bending it back for future use.
Then use a piece of jumper wire to connect the new pin you want to use, with that pin 9 of that top shield.

After that you need to alter your sketch so it knows this new pin is to be used for this function, and then you should be good to go.

There are also possibilities to do this without damaging the shields, but that would require some extra hardware.
You could use some extensions for the pins, and leave pin 9 out.
Instead of that you would put the jumper wire just like what i mentioned before.
That takes some extra hardware and some extra space (height), but it will not destroy your shields.

thank you , i will try to do it :slight_smile: