Hola buenas con todos, soy estudiante de ingenieria en informatica y necesito que porfavor me ayuden con la siguiente duda
Estoy tratando de enviar un dato del arduino a una base de datos de mysql, pero no logro conectarlo al archivo php (localhost)..
porfa... el codigo que estoy usando es este-
#include <SPI.h>
#include <Ethernet.h>
byte mac[]={0x90,0xa2,0xda,0x0d,0xeb,0x4a};
byte ip[]={192,168,0,5};
byte netmask[]={255,255,255,0};
byte gateway[]={192,168,0,1};
//int valor=1;
EthernetServer server=EthernetServer(80);
void setup()
{
Ethernet.begin(mac,ip,gateway,netmask);
server.begin();
Serial.begin(9600);
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
//client.println("Refresh: 1"); // refresh the page automatically every 5 sec
client.println();
client.println("");
client.println("");
IPAddress server(127,0,0,1); // Google
client.println("GET arduino/arduino.php?valor=32 HTTP/1.0");
// output the value of each analog input pin
// valor = valor +1;
client.print("Temperatura de Lima es : ");
// client.print(valor);
client.println("
");
client.println("");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}