allora questo è il client HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>Movimeto Cybot </TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGED" CONTENT="20100529;10021400">
<SCRIPT LANGUAGE="Javascript1.3">
var xmlhttp
function GetXmlHttpObject(){
if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
document.write("all");
}
if (window.ActiveXObject){// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
document.write("ie5-6");
}
return null;
document.write("null");
}
function run(url, param){
xmlhttp = GetXmlHttpObject();
xmlhttp.open("SEND",url,false);
xmlhttp.send(param);
}
</SCRIPT>
</HEAD>
<BODY LANG="it-IT" DIR="LTR">
<H1 ALIGN=CENTER><I>Movimento Cybot </I>
</H1>
<FORM ACTION="">
<P><INPUT TYPE=BUTTON VALUE="avanti" STYLE="width: 1.62cm; height: 0.93cm" ONCLICK="run("192,168,1,2",1)">
<INPUT TYPE=BUTTON VALUE="indietro" STYLE="width: 1.91cm; height: 0.93cm" ONCLICK="run("192,168,1,2",2)">
<INPUT TYPE=BUTTON VALUE="destra" STYLE="width: 1.62cm; height: 0.93cm" ONCLICK="run("192,168,1,2",3)">
<INPUT TYPE=BUTTON VALUE="sinistra" STYLE="width: 1.77cm; height: 0.93cm" ONCLICK="run("192,168,1,2",4)">
<INPUT TYPE=BUTTON VALUE="stop" STYLE="width: 1.77cm; height: 0.93cm" ONCLICK="run("192,168,1,2",0)">
</P>
</FORM>
</BODY>
</HTML>
e questo è il server Arduino.
#include <WiShield.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// 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 = {"CYBOT"}; // max 32 bytes
int RHfwd = 8; // pin motore di dx avanti
int RHbck = 9; // pin motore di dx indietro
int LHfwd = 10; // pin motore di sx avanti
int LHbck = 11; // pin motore di sx indietro
int rit = 200; // ritardo ad ogni operazione
int n; // lettura dato dal client
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_ADHOC;
unsigned char ssid_len;
unsigned char security_passphrase_len;
//---------------------------------------------------------------------------
void fwd(int r) { // funzione che permette ai 2 motori di andare avanti
digitalWrite(RHbck,LOW);
digitalWrite(LHfwd,HIGH);
digitalWrite(LHbck,LOW);
digitalWrite(RHfwd,HIGH);;
delay(r);
digitalWrite(RHfwd,LOW);
digitalWrite(LHfwd,LOW);
}
void back(int r) { // funzione che permette ai 2 motori di andare indietro
digitalWrite(RHbck,HIGH);
digitalWrite(LHfwd,LOW);
digitalWrite(LHbck,HIGH);
digitalWrite(RHfwd,LOW);;
delay(r);
digitalWrite(RHbck,LOW);
digitalWrite(LHbck,LOW);
}
// funzione che permette di girare a dx; il motore di dx risulterà in LOW mentre il motore di sx sarà in movimento(HIGH)
void giradx(int r) {
digitalWrite(RHbck,LOW);
digitalWrite(LHbck,LOW);
digitalWrite(RHfwd,LOW);
digitalWrite(LHfwd,HIGH);
delay(r);
digitalWrite(LHfwd,LOW);
}
// funzione che permette di girare a sx; il motore di sx risulterà in LOW mentre il motore di dx sarà in movimento(HIGH)
void girasx(int r) {
digitalWrite(RHbck,LOW);
digitalWrite(LHfwd,LOW);
digitalWrite(LHbck,LOW);
digitalWrite(RHfwd,HIGH);
delay(r);
digitalWrite(RHfwd,LOW);
}
void setup()
{
WiFi.init();
pinMode(RHfwd,INPUT);
pinMode(RHbck,INPUT);
pinMode(LHfwd,INPUT);
pinMode(LHbck,INPUT);
}
// This is the webpage that is served up by the webserver
const prog_char webpage[] PROGMEM = {"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<center><h1>Hello World!! I am WiShield</h1><form method=\"get\" action=\"0\">Toggle LED:<input type=\"submit\" name=\"0\" value=\"LED1\"></input></form></center>"};
void loop()
{
WiFi.run();
if(n==49)
fwd(rit);
if(n==50)
back(rit);
if(n==51)
giradx(rit);
if(n==52)
girasx(rit);
}
e a questo manca il settaggio per ricevere il parametro... sicuramente sarà WiFi. qualcosa..