Wifi shield not mounting/connecting- Freetronics Eleven, Wifi Shield R3

HI Everybody,

I am using a Freetronics Eleven (alternate version of the uno here; http://www.freetronics.com/products/eleven#.U-GIekD9zuc and an official Arduino Wifi shield R3.

When attempting to use the sketch below, serial monitor says the Wifi shield is not connected and does not proceed. I have proved the wifi shield etc is working by uploading the Arduino IDE 1.0.5-R2 Xively>WifiDatastreamUpload sketch which connects to the network and does not give the shield not mounted error.

The sketch is for an aquaponics system.
The Eleven is powered via the Micso USB
The link light on the wifi shield comes on using the xively example sketch but no lights at all on the wifi shield when using below sketch.
Connecting to a WPA 2 network.
I have left the Float and Void Loop sections out of the code i have posted.

Can you please help me solve this issue.


// XivelyStationNew.ino

#include <SPI.h>
#include <WiFi.h>
#include <HttpClient.h>
#include <Xively.h>
#include <OneWire.h>
#include <SHT1x.h>

/* ---------------------------------------------- */
/*               Pin Mappings                     */
/* ---------------------------------------------- */

// Level switches
int LevelSwitch0 = 5;
int LevelSwitch1 = 6;
int LevelSwitch2 = 8;
int LevelSwitch3 = 13;

// Temperature sensors
int sensorPin = 12; 

// SHT1x sensor
#define SHTdataPin 11
#define SHTClockPin 9

// Analog sensors
#define LightSensorPort A2
#define PHMeterPort A3

// WaterFlow sensors
int WaterFlow1pin = 2;
int WaterFlow2pin = 3;

/* -------------------------------------------------- */
/*    Initialization section                          */
/* -------------------------------------------------- */

// -------------- ENTER YOUR DATA HERE --------------------

// WiFi initialization
char ssid[] = "ssid"; //  your network SSID (name) 
char pass[] = "pass";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

// Your Xively key to let you upload data
char xivelyKey[] = "Xively key here"; // enter the key, under API Keys
unsigned long feedId = 1558186774;    // enter your feed ID, under Activated
int frequency = 15000; // delay between updates (milliseconds)
// int frequency = 5000; // delay between updates (milliseconds)

// -------------- ENTER YOUR DATA HERE -------------------- 

// Define the strings for our datastream IDs
char sensorId[] = "temp";
XivelyDatastream datastreams[] = {
	XivelyDatastream("00-TempSensor1",  strlen("00-TempSensor1"), DATASTREAM_FLOAT),
	XivelyDatastream("01-TempSensor2",  strlen("01-TempSensor2"), DATASTREAM_FLOAT),
	XivelyDatastream("02-Level0",       strlen("02-Level0"), DATASTREAM_FLOAT),
	XivelyDatastream("03-Level1",       strlen("03-Level1"), DATASTREAM_FLOAT),
	XivelyDatastream("04-Level2",       strlen("04-Level2"), DATASTREAM_FLOAT),
	XivelyDatastream("05-Level3",       strlen("05-Level3"), DATASTREAM_FLOAT),
	XivelyDatastream("06-SHT1xTemp",    strlen("06-SHT1xTemp"), DATASTREAM_FLOAT),
	XivelyDatastream("07-SHT1xHumidity",strlen("07-SHT1xHumidity"), DATASTREAM_FLOAT),
	XivelyDatastream("08-LightSensor",  strlen("08-LightSensor"), DATASTREAM_FLOAT),
	XivelyDatastream("09-PHMeter",      strlen("09-PHMeter"), DATASTREAM_FLOAT),
	XivelyDatastream("10-WaterFlow1",   strlen("10-WaterFlow1"), DATASTREAM_FLOAT),
	XivelyDatastream("11-WaterFlow2",   strlen("11-WaterFlow2"), DATASTREAM_FLOAT),
// Finally, wrap the datastreams into a feed
XivelyFeed feed(feedId, datastreams, 1 /* number of datastreams */);

WiFiClient client;
XivelyClient xivelyclient(client);

// Level switches
int LevelSwitch0Val = 0;
int LevelSwitch1Val = 0;
int LevelSwitch2Val = 0;
int LevelSwitch3Val = 0;

// Temperature sensors
float TempSensor1val = 0.0;
float TempSensor2val = 0.0;
byte TempSensor1addr[8];
byte TempSensor2addr[8];
OneWire ds(sensorPin);

// SHT1x sensor
float humidity = 0.0;
float temp_C = 0.0;
SHT1x sht1x(SHTdataPin, SHTClockPin);

// Analog sensors
int LightSensorVal;
int PHMeterVal;

// Water flow sensors
volatile int NbTopsFan1 = 0;
volatile int NbTopsFan2 = 0;
int WaterFlow1;
int WaterFlow2;

void rpm1() {  NbTopsFan1++; }
void rpm2() {  NbTopsFan2++; }

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

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

	// print the received signal strength:
	long rssi = WiFi.RSSI();
	Serial.print("signal strength (RSSI):");
	Serial.println(" dBm \n");

void setup() {

	// Get address of the first temperature sensor
	if ( !ds.search(TempSensor1addr) )
		Serial.println("No more addresses.");

	// Get address of the second temperature sensor
	if ( !ds.search(TempSensor2addr) )
		Serial.println("No more addresses.");

	// SHT1x sht1x(SHTdataPin, SHTClockPin);	

	Serial.println("Starting single datastream upload to Xively...");

	pinMode(WaterFlow1pin, INPUT);
	pinMode(WaterFlow2pin, INPUT);	

	attachInterrupt(0, rpm1, RISING);
	attachInterrupt(1, rpm2, RISING);	

	// attempt to connect to Wifi network:
	//status = WiFi.begin(ssid, pass);
	// check for the presence of the shield:
    if (WiFi.status() == WL_NO_SHIELD) {
    	Serial.println("WiFi shield not present"); 
    	// don't continue:

	while ( status != WL_CONNECTED) { 
		Serial.print("Attempting to connect to SSID: ");
		// status = WiFi.begin(ssid, keyIndex, pass);
		status = WiFi.begin(ssid, pass);
		// wait 10 seconds for connection:
	Serial.println("Connected to wifi");

You can’t use D7 or D10 to D13 for anything on an Uno if you are using the WiFi shield.

int LevelSwitch3 = 13;

Ah damn. So simple. Thanks heaps. Wish I could provide more input into this great site but my skills are currently minimal. I'll keep spreading the word but :)