Hola gente, espero sea el lugar indicado...
Les comento que habia finalizado un proyecto de una estacion meteorologica la cual me guarda los datos en una base de datos. El problema empezo cuando cambie de ordenador y no conecta el arduino a xampp. comento lo que hice le asigne a xampp una ip fija (la de la placa ethernet), la misma si la pongo en el navegador funciona perfectamente y levanta xampp, pero no levanta en arduino... no se que estoy omitiendo, si alguien tiene una idea estaria mas que agradecida.... ya he mirado varios tutos y no doy con la tecla... desde ya gracias
#include <Ethernet.h>
char databuffer[35];
double temp;
long intervalo = 300000; // es el tiempo de nuestro delay 5 minutos
long tiempo = 0;
long tiempoAnterior = 0;
boolean bandera=1;
// Configuracion del Ethernet Shield
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // Direccion MAC
byte ip[] = { 192,168,1,117 }; // Direccion IP del Arduino
byte server[] = { 192,168,1,102}; // Direccion IP del servidor
EthernetClient client;
int Direccion;
float velocidad;
float velMax;
float temperatura;
float OneHour;
float OneDay;
float presion;
int humedad,i;
String envioDatos = "GET /estacion/carga.php?";
#define parametro1 "&WindDirection="
#define parametro2 "&WindSpeedAverage="
#define parametro2 "&WindSpeedMax="
#define parametro3 "&Temperature="
#define parametro4 "&RainfallOneHour="
#define parametro5 "&BarPressure="
#define parametro6 "&Humidity="
#define parametro7 "&RainfallOneDay="
void getBuffer() //Get weather status data
{
int index;
for (index = 0;index < 35;index ++)
{
if(Serial.available())
{
databuffer[index] = Serial.read();
if (databuffer[0] != 'c')
{
index = -1;
}
}
else
{
index --;
}
}
}
int transCharToInt(char *_buffer,int _start,int _stop) //char to int)
{
int _index;
int result = 0;
int num = _stop - _start + 1;
int _temp[num];
for (_index = _start;_index <= _stop;_index ++)
{
_temp[_index - _start] = _buffer[_index] - '0';
result = 10*result + _temp[_index - _start];
}
return result;
}
int WindDirection() //Wind Direction
{
return transCharToInt(databuffer,1,3);
}
float WindSpeedAverage() //air Speed (1 minute)
{
temp = 0.44704 * transCharToInt(databuffer,5,7);
return temp;
}
float WindSpeedMax() //Max air speed (5 minutes)
{
temp = 0.44704 * transCharToInt(databuffer,9,11);
return temp;
}
float Temperature() //Temperature ("C")
{
temp = (transCharToInt(databuffer,13,15) - 32.00) * 5.00 / 9.00;
return temp;
}
float RainfallOneHour() //Rainfall (1 hour)
{
temp = transCharToInt(databuffer,17,19) * 25.40 * 0.01;
return temp;
}
float RainfallOneDay() //Rainfall (24 hours)
{
temp = transCharToInt(databuffer,21,23) * 25.40 * 0.01;
return temp;
}
int Humidity() //Humidity
{
return transCharToInt(databuffer,25,26);
}
float BarPressure() //Barometric Pressure
{
temp = transCharToInt(databuffer,28,32);
return temp / 10.00;
}
void setup()
{
Ethernet.begin(mac, ip); // Inicializamos el Ethernet Shield
delay(1000); // Esperamos 1 segundo de cortesia
// mySerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
tiempo = millis();
if(tiempo - tiempoAnterior > intervalo)
{
tiempoAnterior = tiempo;
getBuffer();
Serial.print("Wind speed: ");
Serial.print(WindSpeedMax());
Serial.print("Wind Direction: ");
Serial.print(WindDirection());
Serial.println(" ");
Serial.print("Average Wind Speed (One Minute): ");
Serial.print(WindSpeedAverage());
Serial.println("m/s ");
Serial.print("Rain Fall (One Hour): ");
Serial.print(RainfallOneHour());
Serial.println("mm ");
Serial.print("Temperature: ");
Serial.print(Temperature());
Serial.println("C ");
Serial.print("Humidity: ");
Serial.print(Humidity());
Serial.println("% ");
Serial.print("Barometric Pressure: ");
Serial.print(BarPressure());
Serial.println("hPa");
Serial.println("");
Serial.println("");
Direccion = WindDirection();
velocidad=WindSpeedAverage();
temperatura=Temperature();
OneHour=RainfallOneHour();
presion=BarPressure();
humedad = Humidity();
velMax = WindSpeedMax();
OneDay =RainfallOneDay();
Serial.println("Conectando...");
if (client.connect(server, 80)>0) { // Conexion con el servidor
envioDatos += parametro1 + String(Direccion) + parametro2 + String(velocidad)+ parametro3 + String(temperatura) + parametro4 + String(OneHour) + parametro5 + String(presion) + parametro6 + String(humedad) + parametro7 + String(velMax);
client.print(envioDatos);
client.println(" HTTP/1.0");
client.println("User-Agent: Arduino 1.0");
client.println();
Serial.println("Conectado");
} else {
Serial.println("Fallo en la conexion");
}
if (!client.connected()) {
Serial.println("Desconectando!");
}
client.stop();
client.flush();
//delay (300000);
}
}