Arduino ethernet shield + base datos + php +xampp

buenas:
Exactamente lo que quiero hacer es que arduino me guarde lo que esta leyendo de sus 5 puertos anal贸gicos a una base de datos. Arduino con la shield de ethernet me devuelve los datos en texto plano y lo que quiero es guardar ese texto en una base de datos mySQL. Adjunto el c贸digo fuente de arduino
Un saludo y gracias :slight_smile:

/*
 Arduino Data Web Server


聽 encender led http://192.168.1.7/digitalWrite/7/1
聽 apagar led http://192.168.1.7/digitalWrite/7/0
聽 ver valor analgogico en puerto 2 http://192.168.1.7/analogRead/0
 ver聽 valor analogico en puerto 1 http://192.168.1.7/analogRead/1
......
*/

#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>
#include <SPI.h>
#include <avr/pgmspace.h>
#include <string.h>

// MAC address can be anything that is unique within your network.
// IP is the address the Arduino Ethernet Card would respond to.聽 It needs to be an unused address within your network.
byte mac[] = {0x00, 0x1E, 0x2A, 0x77, 0x24, 0x02 };
byte ip[] = {192,168,1,7 }; // This is typically 10.0.0.x



EthernetServer server(80); // Port 80 is http.

//-- Commands and parameters (sent by browser) --
char cmd[15];聽 聽 // Nothing magical about 15, increase these if you need longer commands/parameters
char param1[15];
char param2[15];

//-- Sample Ports ---
void SetupSamplePorts()
{
聽 // To illustrate how to use this, I have an LED and a Potentiometer.
聽 // The 10K potentiometer left lead is connected to GND, right lead to +5V, and middle lead to Analog 0.
聽 // The LED cathode is on digital pin 7 and anode is on pin 8.
聽 pinMode(5,OUTPUT);
聽 pinMode(6,OUTPUT);
聽 pinMode(7,OUTPUT);聽  // I use this pin as GND for the LED.
聽 pinMode(8,OUTPUT); // Sample output, unable to use built-in LED at pin 13 because Ethernet Shield uses pins 10,11,12,13.
}

void setup()
{
聽 Ethernet.begin(mac, ip);
聽 server.begin();

聽 Serial.begin(57600);
聽 SetupSamplePorts();
}

#define bufferMax 128
int bufferSize;
char buffer[bufferMax];

void loop()
{
聽 EthernetClient client = server.available();
聽 if (client)
聽 {
聽 聽 WaitForRequest(client);
聽 聽 ParseReceivedRequest();
聽 聽 PerformRequestedCommands();
聽 聽 
聽 聽 
聽 聽 client.stop();
聽 }
}

void WaitForRequest(EthernetClient client) // Sets buffer[] and bufferSize
{
聽 bufferSize = 0;

聽 while (client.connected()) {
聽 聽 if (client.available()) {
聽 聽 聽 char c = client.read();
聽 聽 聽 if (c == '\n')
聽 聽 聽 聽 break;
聽 聽 聽 else
聽 聽 聽 聽 if (bufferSize < bufferMax)
聽 聽 聽 聽 聽 buffer[bufferSize++] = c;
聽 聽 聽 聽 else
聽 聽 聽 聽 聽 break;
聽 聽 }
聽 }
聽 
聽 PrintNumber("bufferSize", bufferSize);
}

void ParseReceivedRequest()
{
聽 Serial.println("in ParseReceivedRequest");
聽 Serial.println(buffer);
聽 
聽 //Received buffer contains "GET /cmd/param1/param2 HTTP/1.1".聽 Break it up.
聽 char* slash1;
聽 char* slash2;
聽 char* slash3;
聽 char* space2;
聽 
聽 slash1 = strstr(buffer, "/") + 1; // Look for first slash
聽 slash2 = strstr(slash1, "/") + 1; // second slash
聽 slash3 = strstr(slash2, "/") + 1; // third slash
聽 space2 = strstr(slash2, " ") + 1; // space after second slash (in case there is no third slash)
聽 if (slash3 > space2) slash3=slash2;

聽 PrintString("slash1",slash1);
聽 PrintString("slash2",slash2);
聽 PrintString("slash3",slash3);
聽 PrintString("space2",space2);
聽 
聽 // strncpy does not automatically add terminating zero, but strncat does! So start with blank string and concatenate.
聽 cmd[0] = 0;
聽 param1[0] = 0;
聽 param2[0] = 0;
聽 strncat(cmd, slash1, slash2-slash1-1);
聽 strncat(param1, slash2, slash3-slash2-1);
聽 strncat(param2, slash3, space2-slash3-1);
聽 
聽 PrintString("cmd",cmd);
聽 PrintString("param1",param1);
聽 PrintString("param2",param2);
}

void PerformRequestedCommands()
{
聽 if ( strcmp(cmd,"digitalWrite") == 0 ) RemoteDigitalWrite();
聽 if ( strcmp(cmd,"analogRead") == 0 ) RemoteAnalogRead();
}

void RemoteDigitalWrite()
{
聽 int ledPin = param1[0] - '0'; // Param1 should be one digit port
聽 int ledState = param2[0] - '0'; // Param2 should be either 1 or 0
聽 digitalWrite(ledPin, ledState);

聽 //-- Send response back to browser --
聽 server.print("El didodo conectado en el puerto ");
聽 server.print(ledPin, DEC);
聽 server.print(" esta ahora:聽 ");
聽 server.print( (ledState==1) ? "ENCENDIDO" : "APAGADO" );

聽 //-- Send debug message to serial port --
聽 Serial.println("RemoteDigitalWrite");
聽 PrintNumber("ledPin", ledPin);
聽 PrintNumber("ledState", ledState);
}

void RemoteAnalogRead()
{
聽 // If desired, use more server.print() to send http header instead of just sending the analog value.
聽 int analogPin = param1[0] - '0'; // Param1 should be one digit analog port
聽 float analogValue =(float) analogRead(analogPin);
聽 analogValue=analogValue*0.42;
聽 
聽 //-- Send response back to browser --
聽 server.print("Por el pin A");
聽 server.print(analogPin, DEC);
聽 server.print(" esta leyendo una temperatura de: ");
聽 server.print(analogValue,DEC);
聽 
聽 //-- Send debug message to serial port --
聽 Serial.println("RemoteAnalogRead");
聽 PrintNumber("analogPin", analogPin);
聽 PrintNumber("analogValue", analogValue);
}

void PrintString(char* label, char* str)
{
聽 Serial.print(label);
聽 Serial.print("=");
聽 Serial.println(str);
}

void PrintNumber(char* label, int number)
{
聽 Serial.print(label);
聽 Serial.print("=");
聽 Serial.println(number, DEC);
}