Tenho o seguinte código no arduino:
#include <SPI.h>
#include <Ethernet.h>
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 5, 177);
IPAddress subnet( 255, 255, 192, 0);
IPAddress gateway( 192, 168, 63, 254);
EthernetServer server(80);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
dht.begin();
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
float hi = dht.computeHeatIndex(f, h);
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
if (c == '\n' && currentLineIsBlank) {
client.println("HTTP/1.1 200 OK");
client.print("GET http://meudominio.com.br/teste_arduino.php?nivel=elevado");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println("Refresh: 5");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.print("Humidity: ");
client.print(h);
client.print(" %\t");
client.print("Temperature: ");
client.print(t);
client.print(" *C ");
client.print(f);
client.print(" *F\t");
client.print("Heat index: ");
client.print(hi);
client.println(" *F <br>");
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disconnected");
Ethernet.maintain();
}
}
O código funciona corretamente, consigo acessá-lo pelo endereço do IP e visualizar os dados, porém, tenho a seguinte linha: client.print("GET http://meudominio.com.br/teste_arduino.php?nivel=elevado");
E com esta linha gostaria que o arduino mandasse um get para a página PHP especificada. Porém, ele não está realizando isto. O que posso ter feito de errado?