WiShield and Arduino Deumilanove wifi-serial

I have a WiShield and arduino Duemilanove, and what I want to do is basically turn on lets say 3 LED's over wifi but when I lets say click on the on button on the webpage I want to send over serial a command saying something like "turn on led 2". I am kind of new to this.

I want to do is basically turn on lets say 3 LED's over wifi but when I lets say click on the on button on the webpage I want to send over serial a command saying something like "turn on led 2".

Sending data over WiFi and sending data over serial are two completely different things. Why would you want to invest in a WiFi shield if the Arduino is tethered to a computer by the serial cable?

It wont be connected over cable to the computer, it will be connected to another board so basically I will have two arduino's one will have a wifi shield that will receive data over wifi so lets say I will have a web page served that shows statuses of 3 leds that you would click on one status and send an on command over wifi to the wifi shield and after it is received I want that arduino to send data to another arduino all i need it to send is "turn on 3.."

It wont be connected over cable to the computer, it will be connected to another board so basically I will have two arduino's one will have a wifi shield that will receive data over wifi so lets say I will have a web page served that shows statuses of 3 leds that you would click on one status and send an on command over wifi to the wifi shield and after it is received I want that arduino to send data to another arduino all i need it to send is "turn on 3.."

Ah, that makes more sense.

So, what is it you need help with?

So I was able to connect the arduino with wifi server to my netgear router and i can display the page but where I am stuck at is getting the LED’s control to display on the page and then once clicked to send over serial.

#include <WiServer.h>

#define WIRELESS_MODE_INFRA	1
#define WIRELESS_MODE_ADHOC	2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,102};	// 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 = {"SmartHome"};		// 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 = {"DeadBeef"};	// 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;
//---------------------------------------------------------------------------


// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
  
  float temp_in_celsius = 0;
  float temp_in_kelvin=0;
  float temp_in_fahrenheit=0;
  
 //Reads the input and converts it to Kelvin degrees
  temp_in_kelvin = analogRead(0) * 0.004882812 * 100;
  //Converts Kelvin to Celsius minus 2.5 degrees error
  temp_in_celsius = temp_in_kelvin - 2.5 - 273.15; 
  temp_in_fahrenheit = ((temp_in_kelvin - 2.5) * 9 / 5) - 459.67;
  //Print the temperature in Celsius to the serial port
  Serial.print("Celsius: ");
  Serial.println(temp_in_celsius);                  
  //Print the temperature in Fahrenheit to the serial port
  Serial.print("Fahrenheit: ");
  Serial.println(temp_in_fahrenheit);
  Serial.print("Kelvin:  ");
  Serial.println(temp_in_kelvin);
  Serial.println();
        //Temperature
        float h = temp_in_kelvin;
        float t = temp_in_celsius;
        float f = temp_in_fahrenheit;
        float laser = analogRead(1);
        String txt;
        
        //Check to see if the Laser is tripped or not 
        if(analogRead(1)<810){
          txt = "Laser Tripped";
        }else{
          txt = "Laser Not Tripped";
        }  
        // check if returns are valid, if they are NaN (not a number) then something went wrong!
        if (isnan(t) || isnan(h)) {
        	WiServer.print("<html>");  //Here is the code for the html page
         	WiServer.print("Failed to read from Sensor Input");
        	WiServer.println("        </html>");
        } else {
        	WiServer.print("<html>");
        	WiServer.print("<center><H2>Room 1 Temperature Statistics: ID: 1</H2>


");

        WiServer.print("Temperature Kelvin: ");
        WiServer.print(h);
        WiServer.print(" T\t");
        WiServer.print("Temperature Celsius ");
        WiServer.print(t);
        WiServer.println(" *C");
        WiServer.print("Temperature Fehrenhite ");
        WiServer.print(f);
        WiServer.println(" *F");
        WiServer.println("        ");
        WiServer.print("</center>");
        WiServer.print("<center><H3>Laser TripWire Detection in Room 1</H3>


");
        WiServer.print("Detection: ");
        WiServer.print(txt);
        WiServer.println("        ");
        WiServer.print(laser);
        WiServer.print("</html></center>");        // 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(3, OUTPUT);

  // Enable Serial output and ask WiServer to generate log messages (optional)
  Serial.begin(57600);
  
  WiServer.enableVerboseMode(true);

}

void loop(){
if(analogRead(1)<810){
          digitalWrite(3, HIGH);
        }else{
          digitalWrite(3, LOW);
        }  
  // Run WiServer
  WiServer.server_task();
  delay(10);
}

The page you are currently serving has nothing to do with LEDs. You need something completely different in sendMyPage(). You need to send html code that contains a form, with one or more submit type buttons, and an action that directs to the original page. That will cause, in the browser,
http://ArduinoIP/ArduinoPage
to change to
http://ArduinoIP/ArduinoPage?someName=someValue&anotherName=anotherValue
.

The GET request sent in the first case will be
GET /ArduinoPage
(which could be just GET / , if no specific page is requested).

The GET request in the second case will be
GET /ArduinoPage?someName=someValue&anotherName=anotherValue
(which could be just GET /?someName=someValue&anotherName=anotherValue, if no specific page is requested).

On the Arduino, then, you need to be prepared to parse the page, to determine if it is for the original page (no ? in the GET request) or if it is a submit (a ? IS in the GET request).

If so, you then need to parse the GET request to determine what to do. The someName, someValue, anotherName, and anotherValue parts will depend on what names you assign to object on the form, and what values you define for them to send back. Obviously some names and values will be easier to deal with than others.

Once you get the data to the Arduino with the WiFi shield, and get that data parsed, sending something to the other Arduino is easy.

Get the WiFi-wearer working as a server first.