Wishield v1.0 Infra~ Mode not working

This is my code which is working pretty fine in ADHOC mode (The LED lights up and everything works as the code that is added/changed is being done) but im not able to make it work in INfrastructure mode , the led doesn’t lights up on WiShield and my laptop doesn’t recognize the network from shield.

WIll it connect through only the Wifi Router if in INfra~ mode?

/*
 * A simple sketch that uses WiServer to serve a web page
 */


#include <WiServer.h>

#define WIRELESS_MODE_INFRA	1
#define WIRELESS_MODE_ADHOC	2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,137,5};	// IP address of WiShield
unsigned char gateway_ip[] = {192,168,137,4};	// router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network
const prog_char ssid[] PROGMEM = {"WinacroWii"};		// max 32 bytes
int ON, OFF;
unsigned char security_type = 0;	// 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"};	// max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,	// Key 0
				  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	// Key 1
				  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	// Key 2
				  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00	// Key 3
				};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------


// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
  
    // Check if the requested URL matches "/"
    if (strcmp(URL, "/") == 0) {
        // Use WiServer's print and println functions to write out the page content
        WiServer.print("<html>");
        WiServer.print("<center>Click as per Application:</center>");
        WiServer.print("<center><a href='on'>ON</a>
<a href='off'>OFF</a></center>");
        WiServer.print("</html>");
        // URL was recognized
        return true;
    } else if (strcmp(URL, "/on") == 0) {
       digitalWrite(A0, HIGH);
       WiServer.print("<html>");
       WiServer.print("<center>Click as per Application:</center>");
       WiServer.print("<center><a href='on'>ON</a>
<a href='off'>OFF</a></center>");
       WiServer.print("</html>");
      return true;
    } else if (strcmp(URL, "/off")== 0) {
      digitalWrite(A0, LOW);
      WiServer.print("<html>");
      WiServer.print("<center>Click as per Application:</center>");
      WiServer.print("<center><a href='on'>ON</a>
<a href='off'>OFF</a></center>");
      WiServer.print("</html>"); 
      return true;
    } else
    // URL not found
    return false;
    
}


void setup() {
  // Initialize WiServer and have it use the sendMyPage function to serve pages
  WiServer.init(sendMyPage);
  
  // Enable Serial output and ask WiServer to generate log messages (optional)
  Serial.begin(57600);
  WiServer.enableVerboseMode(true);
  pinMode(A0,OUTPUT);
}

void loop(){
 // Run WiServer
  WiServer.server_task();   
  delay(10);
}

anybody can clear up things?

This comment from the code you posted seems to say that it needs an Access Point:

// infrastructure - connect to AP

You can turn your laptop into an AP if you're running Linux. However if you have a wifi router then that is an AP too.

i have currently a windows 7 machine however im used to Puppy Linux a lot as on my old laptop only it could run, is there any remedy to make my windows notebook pc an AP like by using something like MaryFi?

I find that google helps a lot in these situations. E.g searching for " Linux ap" gave a bunch of relevant hits from the first item on http://lmgtfy.com/?q=Linux+ap. This link seems quite relevant: http://linuxwireless.org/en/users/Documentation/hostapd.

A further search for "puppy Linux hostap" give immediate info on how to set up puppy linux as an access point: http://lmgtfy.com/?q=Puppy+Linux+hostapd

I don't use windows for anything serious or useful, but I believe you can configure windows 7 to be an access point without adding any additional software. http://lmgtfy.com/?q=windows+7+access+point

HI DHUNT,

I made the access point successfully and configured the wifi shield with the following code:

/*
 * A simple sketch that uses WiServer to serve a web page
 */


#include <WiServer.h>

#define WIRELESS_MODE_INFRA	1
#define WIRELESS_MODE_ADHOC	2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,137,6};	// IP address of WiShield
unsigned char gateway_ip[] = {192,168,137,4};	// router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network
const prog_char ssid[] PROGMEM = {"winacro_nishant"};		// max 32 bytes
int ON, OFF;
unsigned char security_type = 0;	// 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"};	// max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,	// Key 0
				  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	// Key 1
				  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	// Key 2
				  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00	// Key 3
				};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------


// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
  
    // Check if the requested URL matches "/"
    if (strcmp(URL, "/") == 0) {
        // Use WiServer's print and println functions to write out the page content
        WiServer.print("<html>");
        WiServer.print("<center>Click as per Application:</center>");
        WiServer.print("<center><a href='on'>ON</a>
<a href='off'>OFF</a></center>");
        WiServer.print("</html>");
        // URL was recognized
        return true;
    } else if (strcmp(URL, "/on") == 0) {
      WiServer.print("<center>ON click</center>");
      Serial.println("ON");
      ON++;
      OFF--;
      return true;
    } else if (strcmp(URL, "/off")== 0) {
      WiServer.print("<center>OFF click</center>");
      Serial.println("OFF"); 
      OFF++;
      ON--;
      return true;
    } else
    // URL not found
    return false;
    
}


void setup() {
  // Initialize WiServer and have it use the sendMyPage function to serve pages
  WiServer.init(sendMyPage);
  
  // Enable Serial output and ask WiServer to generate log messages (optional)
  Serial.begin(57600);
  WiServer.enableVerboseMode(true);
  pinMode(A0,OUTPUT);
}

void loop(){

  // Run WiServer
  WiServer.server_task();
  if (ON == 1) 
   digitalWrite(A0, HIGH); 
  if (OFF == 1)
   digitalWrite(A0, LOW);
   
  delay(10);
}

i just changed the IP address of the WiShield to .6 and other things remain the same with the wifi connection network of laptop leaving only the IP which is .5