These are chat archives for esp8266/Arduino

May 2017
Omair Misbah
May 11 2017 05:35
Guys what is ESP8266 and what it do ?
May 11 2017 08:12
@mega-hz try to use a get request. Otherwise you could use an http client
May 11 2017 18:06
and how do i write that get request to the ip?

EthernetClient client = server.available(); // try to get client

if (client)
{ // got client?
boolean currentLineIsBlank = true;

while (client.connected())
  int count = 0;
  if (client.available())
  { // client data available to read
    char c =; // read 1 byte (character) from client
    // limit the size of the stored received HTTP request
    // buffer first part of HTTP request in HTTP_req array (string)
    // leave last element in array as 0 to null terminate string (REQ_BUF_SZ - 1)
    if (req_index < (REQ_BUF_SZ - 1))
      HTTP_req[req_index] = c;          // save HTTP request character
    // last line of client request is blank and ends with \n
    // respond to client only after last line received
    //        if (c == '\n' && currentLineIsBlank)
    if (c == '\n')
      client.println(F("HTTP/1.1 200 OK"));
      client.println(F("Access-Control-Allow-Origin: *"));
      // nur Ajax requests - send XML file
      if (StrContains(HTTP_req, "ajax_inputs"))
        digitalWriteFast(A0, HIGH);               // LED einschalten
        // send rest of HTTP header
        client.println(F("Content-Type: text/xml"));
        client.println(F("Connection: keep-alive"));
        SetLEDs();                                // alle Ausgangs - Zustände setzen
        // send XML file containing input states
        XML_response(client);                     // alle Daten zurücksenden
        digitalWriteFast(A0, LOW);                // LED ausschalten

      // reset buffer index and all buffer elements to 0
      req_index = 0;
      StrClear(HTTP_req, REQ_BUF_SZ);


    // every line of text received from the client ends with \r\n
    if (c == '\n')
      // last character on line of received text
      // starting new line with next character read
      currentLineIsBlank = true;
    else if (c != '\r')
      // a text character was received from client
      currentLineIsBlank = false;
    }             // end if (client.available())
  }               // end while (client.connected())
delay(1);     // give the web browser time to receive the data

client.stop();  // close the connection

} // end if (client)

can i insert that get request a line before client.stop?
May 11 2017 18:14
This site explains the Get requests with an ESP8266. you can form this so your arduino can get the data from the hosted site on the esp
Martin Ayotte
May 11 2017 18:15
This is the client of your server web page, probably a browser on PC. It is not the same client used to issue a GET request to your other ESP. You need to instantiate another client.
May 11 2017 18:17
if i understand it right, the routine above must be 2x times? one with the ip of the esp and the other one?
Martin Ayotte
May 11 2017 19:38
Nope, the above is server handling an incoming request. What you are looking for is how to send an outgoing request.