Ok, here is repaired code:
#include <UIPEthernet.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//byte ip[] = { 10, 0, 0, 177 };
char server[] = { "www.jakubmiga.eu"}; // Google
EthernetClient client;
void setup()
{
Serial.begin(9600);
Serial.println("Starting...");
Ethernet.begin(mac);
}
void loop()
{
double fTemp;
double therm = Thermister(analogRead(A0)); // Read sensor
client.connect(server, 80);
delay(500);
Serial.println("Connecting...");
if (client.connected()) {
Serial.println("Connected");
client.print("GET /add_temp.php?temp=");
client.print(therm);
client.println(" HTTP/1.1");
client.println("Host: www.jakubmiga.eu");
client.println();
} else {
Serial.println("Connect failed");
}
if (client.available()>0) {
char c = client.read();
Serial.print(c);
}
if (0 == (millis()%1000))
Serial.println(millis()); //debug output
}
double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celcius
return Temp;
}
It works good but I want measure and send temperature EVERY 5 minutes.
Put delay to loop is not good idea, It does not periodically works.
Thanks