Hello;
I build a small web server from an Uno and the cheap ENC28J60.
The library I use is the ETHER_28J60.h for its simplicity and lightweight.
I forward the port and I can access the datas from my barometer by entering the IP of the router.
Unfortunately, after few hours the ENC disconnect and is not attached anymore on the router (Netgear).
Only a reset of the arduino launch it again.
I am looking for ideas where this trouble comes from.
#include <SFE_BMP180.h>
#include <Wire.h>
SFE_BMP180 pressure;
char status;
double T,P,p0,a;
#include "etherShield.h"
#include "ETHER_28J60.h"
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // this just needs to be unique for your network,
// so unless you have more than one of these boards
// connected, you should be fine with this value.
static uint8_t ip[4] = {192, 168, 1, 3}; // the IP address for your board. Check your home hub
// to find an IP address not in use and pick that
// this or 10.0.0.15 are likely formats for an address
// that will work.
static uint16_t port = 80; // Use port 80 - the standard for HTTP
ETHER_28J60 e;
void setup()
{
pressure.begin();
e.setup(mac, ip, port);
}
void loop()
{
P = getPressure();
if (e.serviceRequest())
{
e.print("<meta http-equiv=refresh content=60 >");
e.print("<H1>Meteo Aarhus</H1>
");
e.print("Pression: ");
e.print(P);
e.print("
Temperature: ");
e.print(T);
e.respond();
}
delay(200);
}
double getPressure()
{
status = pressure.startTemperature();
if (status != 0)
{
delay(status);
status = pressure.getTemperature(T);
if (status != 0)
{
status = pressure.startPressure(3);
if (status != 0)
{
delay(status);
status = pressure.getPressure(P,T);
if (status != 0)
{
return(P);
}
else Serial.println("error retrieving pressure measurement\n");
}
else Serial.println("error starting pressure measurement\n");
}
else Serial.println("error retrieving temperature measurement\n");
}
else Serial.println("error starting temperature measurement\n");
}
Thank you so much.