Problem with Arduino wifi sheild

I'm using an Arduino Uno, with the Wifi Shield to attempt to upload 1 channel (float) to my Xively feed.

I'm using a modified form of the basic tutorial script. The problem is that the shield does not connect to the wifi, I keep getting Attempting to connect to SSID but without any success.

I Upgraded the WiFi shield firmware following the steps posted at the website.

I tried the program with different version 1.02, 1.05, 1.64 and 1.66m but still it did not connect.

Please I need help in this matter.

Thanks.

Also, when I used web client library posted at Arduino website.

It connects to the network and it shows the IP address, however it disconnect quickly from the server

The example seems to work and your modified code doesn't work at all.

Maybe post your modified code to see if there is something wrong.

/*
##Xively WiFi Sensor Tutorial##
This sketch is designed to take sensors (from photocell) and upload the values to Xively
at consistant intervals. This sketch is reusable and can be adapted for use with many different sensors. Derived from Xively Ardino Sensor Client by Sam Mulube.

By Calum Barnes 3-4-2013
BSD 3-Clause License - [The 3-Clause BSD License – Open Source Initiative]
Copyright (c) 2013 Calum Barnes
*/
#include <SPI.h>
#include <WiFi.h>
#include <HttpClient.h>
#include <Xively.h>

char ssid[] = "ABDUL RAHMAN"; // your network SSID (name)
char pass[] = ;

//char ssid[] = "SSID_HERE"; // your network SSID (name)
//char pass[] = "PASS_HERE"; // 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[] = "mIdzq4T2PdPhev0BwbWHRAw2B4JRa3EWPPy1yORFxuOFdhY9";
//your xively feed ID
#define xivelyFeed 648607764
//datastreams
char sensorID[] = "Sensor";
//char ledID[] = "LED_CHANNEL";

// Analog pin which we're monitoring (0 and 1 are used by the Ethernet shield)
#define sensorPin A2
//led connected pin
//#define ledPin 9

// Define the strings for our datastream IDs
XivelyDatastream datastreams[] = {
XivelyDatastream(sensorID, strlen(sensorID), DATASTREAM_FLOAT)
//XivelyDatastream(ledID, strlen(ledID), DATASTREAM_FLOAT),
};
// Finally, wrap the datastreams into a feed
XivelyFeed feed(xivelyFeed, datastreams, 1 /* number of datastreams */);

WiFiClient client;
XivelyClient xivelyclient(client);

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 \n");
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
//pin setup
pinMode(sensorPin, INPUT);
//pinMode(ledPin, OUTPUT);

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

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

void loop() {

///////////////////////////////////////////////////////
//read sensor values
int sensorValue = analogRead(sensorPin);
datastreams[0].setFloat(sensorValue);

//print the sensor valye
Serial.print("Read sensor value ");
Serial.println(datastreams[0].getFloat());

//send value to xively
Serial.println("Uploading it to Xively");
int ret = xivelyclient.put(feed, xivelyKey);
//return message
Serial.print("xivelyclient.put returned ");
Serial.println(ret);
Serial.println("");

//delay between calls
delay(15000);
}

I only get this at the serial monitor:

Starting single datastream upload to Xively...

Attempting to connect to SSID: ABDUL RAHMAN
Attempting to connect to SSID: ABDUL RAHMAN
Attempting to connect to SSID: ABDUL RAHMAN
Attempting to connect to SSID: ABDUL RAHMAN

There is no connection and the LINK LED is not ON.

Also, when I used wifiWebClient from the library, this is what I get on the serial monitor:

Attempting to connect to SSID: ABDUL RAHMAN
Connected to wifi
SSID: ABDUL RAHMAN
IP Address: 192.168.1.15
signal strength (RSSI):-74 dBm

Starting connection to server...
connected to server
HTTP/1.1 302 Found
Location: arduino - Google Search
Cache-Control: private
Content-Type: text/html; charset=UTF-8
P3P: CP="This is not a P3P policy! See P3P and Google's cookies - Google Account Help for more info."
Date: Wed, 09 Dec 2015 16:42:11 GMT
Server: gws
Content-Length: 276
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: PREF=ID=1111111111111111:FF=0:TM=1449679331:LM=1449679331:V=1:S=GfhULUXMl1gBUhyi; expires=Thu, 31-Dec-2015 16:02:17 GMT; path=/; domain=.google.com
Set-Cookie: NID=74=XyI_gU1t65OEMftIWP1YvBFbxToNYvmdFwWWh6ieFQexindPm_B-IP3q__E8miAbOhMAihUudcke3zuGiGvzlWg4ndBhrBIprLOho7WHvyFRYslYAqfBMjQ-xkU9M4ugMttGy6pvcQ; expires=Thu, 09-Jun-2016 16:42:11 GMT; path=/; domain=.google.com; HttpOnly
Connection: close

302 Moved

302 Moved

The document has moved here.

disconnecting from server.

  1. Please use
tags when posting code.

2. The WiFiWebClient example is working correctly. It configures Wifi, downloads a web page, and then disconnects.
 
3. Is your network using WEP? Notice this comment?
[code]int keyIndex = 0;            // your network key Index number (needed only for WEP)

If you aren't using WEP, then you need to change this line:

status = WiFi.begin(ssid, keyIndex, pass);

It should match the WiFi.begin that is in the client example (hint, remove the keyIndex).[/code]