Hello everybody,
Has anyone experienced with this ESP8266 ESP-13 WiFi Web Sever Shield?
http://www.smartarduino.com/view.php?id=94660
I can not get a GET query as a web client on my server.
Am grateful for any help.
Hello everybody,
Has anyone experienced with this ESP8266 ESP-13 WiFi Web Sever Shield?
http://www.smartarduino.com/view.php?id=94660
I can not get a GET query as a web client on my server.
Am grateful for any help.
I can not get a GET query as a web client on my server.
I'm sure that the code that you didn't post would clarify just what this means.
I have a code with the Uno and Ethernet. I would like to exchange the Ethernet shield against an WiFi ESP-13 from www.doit.am.
The WiFi ESP-13 connects itself through its own program, over my router, with my server.
On the server is a PHP-script, which I would like to read.
Unfortunately, I do not understand what I need to change my code for it to work.
I would be very happy about help. I can not get any further.
Enclosed by the Arduino / Ethernet code:
// *******************************************************************************************************
// Bibliotheken:
// *******************************************************************************************************
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
// ******************************************************************************************************
// PIN-Belegung LCD Display:
// ******************************************************************************************************
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
// ******************************************************************************************************
// Netzwerkeinstellungen:
// ******************************************************************************************************
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01
};
IPAddress ip(192, 168, 178, 70);
IPAddress myDns(1, 1, 1, 1);
EthernetClient client;
// *****************************************************************************************************
// Konstanten und Einstellungen:
// *****************************************************************************************************
const unsigned long requestInterval = 15000; // Verzoegerung zwischen den Anfragen
char server[] = "www.Testserver.de";
unsigned long lastConnectionTime = 0; // Zeit seit letzter Verbindung mit dem Server (in Millisekunden)
const unsigned long postingInterval = 10L * 1000L; // Zeit zwischen den Uploads (in Millisekunden)
// das "L" ist erforderlich, um lange Typnummern zu verwenden
boolean requested; // Kontrolle, ob seit Verbindung ein entsprechenden Antrag gestellt wurde
unsigned long lastAttemptTime = 0; // Zeit in Millisekunden, seit der letzten Serververbindung
String currentLine = ""; // zu erwartende Zeichenfolge vom Server
String fbcount = "";
boolean readingFbcount = false; // wenn das Ergebnis gelesen wird
// *****************************************************************************************************
void setup() {
currentLine.reserve(256);
fbcount.reserve(100);
Serial.begin(9600);
while (!Serial) {
;
}
delay(1000);
// *****************************************************************************************************
// Versuche eine DHCP-Verbindung zu oeffnen:
// *****************************************************************************************************
Serial.println("Es wird versucht, eine IP-Adresse vom DHCP abzurufen:");
lcd.begin(16, 2);
lcd.print(" IP Adresse");
lcd.setCursor(0,7);
lcd.print(" wird abgerufen");
if (!Ethernet.begin(mac)) {
Serial.println("Es konnte keine IP-Adresse vom DHCP abgerufen werden, es wird versucht, mit der festen IP-Adresse eine Verbindung aufzubauen");
Ethernet.begin(mac, ip, myDns);
Serial.print("Meine IP-Adresse:");
Serial.println(Ethernet.localIP());
lcd.begin(16, 2);
lcd.print("IP Adresse:");
lcd.setCursor(0,7);
lcd.print(Ethernet.localIP());
}
}
// *****************************************************************************************************
// Datenauswertung
// *****************************************************************************************************
void loop()
{
if (client.connected()) {
if (client.available()) {
// Eingangs Bytes lesen:
char inChar = client.read();
Serial.write(inChar);
// *****************************************************************************************************
// fuege eingehende Byte an das Zeilenende an:
currentLine += inChar;
// wenn eine neue Zeile beginnt, deaktivieren die aktive Zeile:
if (inChar == '\n') {
currentLine = "";
}
if ( currentLine.endsWith("{"fan_count":")) {
readingFbcount = true; // true
fbcount = "";
}
if (readingFbcount) {
if (inChar != ',') {
fbcount += inChar;
}
else {
readingFbcount = false;
Serial.println(fbcount);
lcd.begin(16, 2);
lcd.print(" Temperatur");
lcd.setCursor(0,7);
lcd.print(" Grad" + fbcount);
// Schliesst die Verbindung zum Server:
client.stop();
}
}
}
}
else if (millis() - lastConnectionTime > postingInterval) {
httpRequest();
}
}
// *****************************************************************************************************
// Datenabruf vom Server
// *****************************************************************************************************
void httpRequest() {
client.stop();
if (client.connect(server, 80)) {
Serial.println("Verbindung zum Server...");
client.println("GET /Testordner/Testdatei.php HTTP/1.1");
Serial.println("Abruf der Informstion...");
client.println("Host: www.Testserver.de");
client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();
lastConnectionTime = millis();
} else {
Serial.println("Keine Verbindung zum Server");
lcd.begin(16, 2);
lcd.print("Keine Verbindung");
lcd.setCursor(0,7);
lcd.print("zum Server");
}
}
// *****************************************************************************************************
Unfortunately, I do not understand what I need to change my code for it to work.
You need to change the programmer.