I apologize if this is already discussed elsewhere, but I keep getting errors when I try to search the forums (Daemon not available?).
I have a small program working fine under 1.0.1 that simply reads a DHT11 temp/humidity sensor and serves a simple web page to tell me the current status.
I just upgraded to 1.0.3, and the same code will no longer compile. The specific line at issue is identified in my header below.
The other oddity with this code (in 1.0.1) is that it runs great when served to an Ipad, but has an odd behavior when to my PC.
The specifics of both problems are captured in the header. Thanks in advance for help on either/both of these problems!
Gowfster
// This is simple Ethernet server for my first try
// I had to change Server to EthernetServer, and Client to EthernetClient to get this to work
// This file works great under Arduino 1.0.1, but I get error on following line in 1.0.3
// dht11 DHT11; I don't know why or how to resolve
// The other issue I'm having is that from my IPAD, this works just fine, but if I access from PC,
// The counter seems to increment by two for a single access. I have no idea why?
#include <SPI.h>
#include <Ethernet.h>
#include <dht11.h>
#include <Versalino.h>
dht11 DHT11;
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] = {192,168,1,149};
byte PassCount = 0;
EthernetServer server(80);
void setup() {
Ethernet.begin(mac,ip);
server.begin();
Serial.begin(9600);
pinMode(6,OUTPUT);
DHT11.attach(2);
Serial.begin(9600);
Serial.println("DHT11 Over Ethernet TEST PROGRAM ");
}
void loop() {
EthernetClient client = server.available();
if (client) {
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
Serial.println("enter code body");
client.println("
");
client.println("Arduino Thermometer ");
client.println(PassCount);
PassCount++;
Serial.println(PassCount);
client.println("
");
for (int vmreads=0; vmreads<1; vmreads++){
int chk = DHT11.read();
switch (chk)
{
case 0:
Serial.println("OK");
break;
case -1:
Serial.println("Checksum error");
break;
case -2:
Serial.println("Time out error");
break;
default:
Serial.println("Unknown error");
break;
}
client.println("
");
client.print("Temperature (F): ");
client.println((int)DHT11.fahrenheit(), DEC);
client.println("
");
client.print("Humidity (%): ");
client.println((int)DHT11.humidity, DEC);
client.println("
");
}
client.println("");
client.stop();
delay(100);
}
}