1 line Error

#include <DHT.h>
#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x4A, 0xB3 }; // RESERVED MAC ADDRESS
EthernetClient client;

#define DHTPIN 2 // SENSOR PIN
#define DHTTYPE DHT11 // SENSOR TYPE - THE ADAFRUIT LIBRARY OFFERS SUPPORT FOR MORE MODELS
DHT dht(DHTPIN, DHTTYPE);

long previousMillis = 0;
unsigned long currentMillis = 0;
long interval = 250000; // READING INTERVAL

int t = 0; // TEMPERATURE VAR
int h = 0; // HUMIDITY VAR
String data;

void setup() {
Serial.begin(9600);

if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
}

dht.begin();
delay(10000); // GIVE THE SENSOR SOME TIME TO START

h = (int) dht.readHumidity();
t = (int) dht.readTemperature();

data = "";
}

void loop(){

currentMillis = millis();
if(currentMillis - previousMillis > interval) { // READ ONLY ONCE PER INTERVAL
previousMillis = currentMillis;
h = (int) dht.readHumidity();
t = (int) dht.readTemperature();
}

data = "temp1=" + t + "&hum1=" + h;

if (client.connect("www.*****..com",80)) { // REPLACE WITH YOUR SERVER ADDRESS
client.println("POST /add.php HTTP/1.1");
client.println("Host: *****.
.com"); // SERVER ADDRESS HERE TOO
client.println("Content-Type: application/x-www-form-urlencoded");
client.print("Content-Length: ");
client.println(data.length());
client.println();
client.print(data);
}

if (client.connected()) {
client.stop(); // DISCONNECT FROM THE SERVER
}

delay(2000); // WAIT FIVE MINUTES BEFORE SENDING AGAIN
}

===============================================
above i got an error (highlighted in red)

exit status 1
invalid operands of types 'const char*' and 'const char [7]' to binary 'operator+'

Any kind souls out there to help me with that? Thanks in advance :slight_smile:

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks. Tom.. :slight_smile:

data = "temp1=" + t + "&hum1=" + h;

data is a String
t and h are ints

No wonder you can't concatenate them and put them in the String

which should i change?

You could turn t and h into Strings.

Or you could not use Strings at all.
And you could start using code tags.