Bonjour,
J'essaye d'envoyer les données d'un capteur de température (tinkerkit) avec une arduino ethernet a une base de données Mysql sur un serveur local avec WampServeur après plusieurs essaies je n'arrive pas
quand je marque directement "localhost/add.php?temp1= " les valeurs se mettent bien dans la base de données mais avec arduino aucun résultat
voila mon code :
// Initialize the Ethernet server library
EthernetClient client;
void setup() {
// Serial.begin starts the serial connection between computer and Arduino
Serial.begin(9600);
// start the Ethernet connection
Ethernet.begin(mac, ip);
}
void loop() {
C = therm.getCelsius();
Serial.print(C);
// Connect to the server (your computer or web page)
if (client.connect(server, 80)) {
client.print("GET /add.php?");
client.print("temp1=");
client.print(C);
client.println(" HTTP/1.1"); // Part of the GET request
client.println("Host: 192.168.1.3");
client.println("Connection: close"); // Part of the GET request telling the server that we are over transmitting the message
client.println(); // Empty line
client.println(); // Empty line
client.stop(); // Closing connection to server
}
else {
// If Arduino can't connect to the server (your computer or web page)
Serial.println("--> connection failed\n");
}
// Give the server some time to recieve the data and store it. I used 10 seconds here. Be advised when delaying. If u use a short delay, the server might not capture data because of Arduino transmitting new data too soon.
delay(10000);
}