Arduino Robot with WiFi Shield

Hello.

My project requires to exchange data between [Arduino Robot and PC via WiFi connection.

I thought it would be easy to connect Robot to [WifiShield, but, as was proven by some topics at this forum, it’s not.

I used standard example for scanning networks with some minor changes.

Like adding pins_arduino.h to mess with LED on the shield.

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


void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

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

  // Print WiFi MAC address:
  printMacAddress();

  // scan for existing networks:
  Serial.println("Scanning available networks...");
  listNetworks();
}

void loop() {
  delay(10000);
  // scan for existing networks:
  Serial.println("Scanning available networks...");
  listNetworks();
}

void printMacAddress() {
  // the MAC address of your Wifi shield
  byte mac[6];                     

  // print your MAC address:
  WiFi.macAddress(mac);
  Serial.print("MAC: ");
  Serial.print(mac[5],HEX);
  Serial.print(":");
  Serial.print(mac[4],HEX);
  Serial.print(":");
  Serial.print(mac[3],HEX);
  Serial.print(":");
  Serial.print(mac[2],HEX);
  Serial.print(":");
  Serial.print(mac[1],HEX);
  Serial.print(":");
  Serial.println(mac[0],HEX);
}

void listNetworks() {
  // scan for nearby networks:
  Serial.println("** Scan Networks **");
  int numSsid = WiFi.scanNetworks();
  if (numSsid == -1)
  { 
    Serial.println("Couldn't get a wifi connection");
    while(true);
  } 

  // print the list of networks seen:
  Serial.print("number of available networks:");
  Serial.println(numSsid);

  // print the network number and name for each network found:
  for (int thisNet = 0; thisNet<numSsid; thisNet++) {
    Serial.print(thisNet);
    Serial.print(") ");
    Serial.print(WiFi.SSID(thisNet));
    Serial.print("\tSignal: ");
    Serial.print(WiFi.RSSI(thisNet));
    Serial.print(" dBm");
    Serial.print("\tEncryption: ");
    printEncryptionType(WiFi.encryptionType(thisNet));
  }
}

void printEncryptionType(int thisType) {
  // read the encryption type and print out the name:
  switch (thisType) {
  case ENC_TYPE_WEP:
    Serial.println("WEP");
    break;
  case ENC_TYPE_TKIP:
    Serial.println("WPA");
    break;
  case ENC_TYPE_CCMP:
    Serial.println("WPA2");
    break;
  case ENC_TYPE_NONE:
    Serial.println("None");
    break;
  case ENC_TYPE_AUTO:
    Serial.println("Auto");
    break;
  } 
}

To connect it to the robot i removed LCD screen and remapped pins in spi_drv.cpp.

#define DATAOUT 	16 // MOSI
#define DATAIN  	14 // MISO
#define SPICLOCK  	15 // sck
#define SLAVESELECT 27 // ss
#define SLAVEREADY 	26  // handshake pin
#define WIFILED 	10  // led on wifi shield

But i always get this message through the serial port “WiFi shield not present”. How does it even understanf if it’d present or not, what’s the criterion for this?

I can provide photos of the connection between the shield and the robot if needed.](http://arduino.cc/en/Guide/ArduinoWiFiShield)](http://arduino.cc/en/Main/Robot/)

I solved this issue. Check here how: http://arduinorobothelp.wordpress.com/

I have to say thanks for posting how you solved it. You even made a webpage for the workaround. Outstanding!