So i tried it with this code :
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 192,168,0,203 };
byte Ethernet::buffer[500];
BufferFiller bfill;
void setup () {
if (ether.begin(sizeof Ethernet::buffer, mymac,28) == 0)
Serial.println( "Failed to access Ethernet controller");
ether.staticSetup(myip);
pinMode(22,OUTPUT);
}
void loop () {
word len = ether.packetReceive();
word pos = ether.packetLoop(len);
char* data = (char *) Ethernet::buffer + pos;
if(strncmp("GET / ", data, 6) == 0) {
char *token = strtok(data, "/"); // Get everything up to the /
if(token) // If we got something
{
char *name = strtok(NULL, "="); // Get the first name. Use NULL as first argument to keep parsing same string
while(name == "mode")
{
char *valu = strtok(NULL, "&");
if(valu == "blink")
{
digitalWrite(22, HIGH); //YES PORT 22. It's an arduino port.
// Do something with name and valu
name = strtok(NULL, "="); // Get the next name
}
}
}
}
}
didn't work. what's my fault?