Hi. Sorry for the confusing subject tile.
I am trying to make a automatic flower "guard" that is suposed to water a couple of plants when the soil is estimated to be too dry. This is done with the arduino taking measurements from two analog pins and send their value to a php-script on a web server, storing the values in a database and presenting them on a web page. I works fine exept for the fact that measurements are only sent once. If I want to get measurements presented on the web page continually I must compile my arduino program again. I have made a small version of my main code that only sends values to the web server from the analog pins to make troubleshooting easier.
#include <SPI.h>
#include <Ethernet.h>
// Pin Defination:---------------------------------------------------------------------------------------------------------------
unsigned int localPort = 8888;
int fukt_sensor_01 = A5; // Analog fuktighetsmätare Input_Pin 1
int fukt_sensor_02 = A4; // Analog fuktighetsmätare Input_Pin 2
//+++++++++++++++++++++++++++++++++++++++++++++ Define Values ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int fukt_val_01, fukt_val_02;
// +++++++++++++++++++++++++++++++++ Arduino standard setup +++++++++++++++++++++++++++++++++++++++++++
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x3C, 0xAE }; //Arduino MAC
byte ip[] = { 193,10,39,166 }; //Arduino IP
byte server[] = { 194,68,48,95 }; // benriach.widell.net
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
Client client(server, 80);
void setup()
{
// initialize the pins
//-------------sen_01---------------
pinMode(fukt_sensor_01,INPUT); // Analog pin
//-------------sen_02---------------
pinMode(fukt_sensor_02,INPUT); // Analog pin
Ethernet.begin(mac, ip);
// setup serial communication
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
delay(2000);
if (client.connect())
{
Serial.println("network connected");
}
else
{
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop ()
{
//======================== For sensor 01 ===============================================================================
fukt_val_01 = analogRead(fukt_sensor_01); // read sensor 01
delay(500);
//======================== For sensor 02 ===============================================================================
fukt_val_02 = analogRead(fukt_sensor_02); // read sensor 02
char values_to_send[70];
sprintf(values_to_send,"%s%d%s%d%s\n","GET /~david/test.php?fukt_val_01=",fukt_val_01,"&fukt_val_02=",fukt_val_02," HTTP/1.0");
client.println(values_to_send);
delay(10000);
}