WiShield

Hi

I have a WiShield from asynclabs and as they are at the end of their journey i am not able to access their forum to post a topic so I will try here.

I have used the simple server example sketch and have changed it to serve a page with some comments on it.

#include <WiServer.h>

#define WIRELESS_MODE_INFRA	1
#define WIRELESS_MODE_ADHOC	2

#define PIR 4

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,2};	// IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1};	// router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network
const prog_char ssid[] PROGMEM = {"arduini"};		// max 32 bytes

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("<title>PIR Project</title>");
         WiServer.print("<center>Press PIR PAGE </center>");
         WiServer.print("<center>By Emmet Fealy</center>
"); 
         WiServer.print("<center>Dundalk</center>
");
         WiServer.print("</html>");   
        
        // URL was recognized
        return true;
    }
    // URL not found
    return false;
}


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

void loop(){

  // Run WiServer
  WiServer.server_task();
 
  delay(10);
}

I have a PIR and have it connected to the wishield on an arduino UNO, I want it when the PIR senses movement to go to a webpage?

Is this possible? Any help would be most appreciated.

Thank you,
Emmet

I have used the simple server example sketch

Server == slave. It does what it is told to do.

I have a PIR and have it connected to the wishield on an arduino UNO

The WiShield won't do anything with the PIR sensor. The Arduino has to.

I want it when the PIR senses movement to go to a webpage?

I think you have a fundamental misconception here. The Ardunio with WiShield could server up different pages, based on whether the PIR sensor is HIGH or LOW, but it can't make a client request a new page.

The client could be set up to make a new request every so often, but it is still pulling the data. The Arduino can not push it.

The Arduino with WiShield can not "go to a web page".

Thanks PaulS for your quick response.

The Ardunio with WiShield could server up different pages, based on whether the PIR sensor is HIGH or LOW

How could I do this?

How could I do this?

Do what? Read the sensor? Determine if the response was HIGH or LOW? Have different WiServer.print() statements in the true block and the false block?

Sorry just didnt read that right there.Thanks for your help.

Emmet