Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request on http #200

Open
Pante90 opened this issue Jun 29, 2020 · 6 comments
Open

request on http #200

Pante90 opened this issue Jun 29, 2020 · 6 comments

Comments

@Pante90
Copy link

Pante90 commented Jun 29, 2020

Hello everyone...
i'm new of this topic...
I try to use this module esp8266-01.
i mounted the lastone sdk versione on https://www.espressif.com/ and this is ok.
now i uploded this sketch.,..
`/*
WiFiEsp example: WebServer
A simple web server that shows the value of the analog input
pins via a web page using an ESP8266 module.
This sketch will print the IP address of your ESP8266 module (once connected)
to the Serial monitor. From there, you can open that address in a web browser
to display the web page.
The web page will be automatically refreshed each 20 seconds.
For more details see: http://yaab-arduino.blogspot.com/p/wifiesp.html
*/

#include "WiFiEsp.h"

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif

char ssid[] = "Twim"; // your network SSID (name)
char pass[] = "12345678"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
int reqCount = 0; // number of requests received

WiFiEspServer server(80);

void setup()
{
// initialize serial for debugging
Serial.begin(115200);
// initialize serial for ESP module
Serial1.begin(9600);
// initialize ESP module
WiFi.init(&Serial1);

// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (true);
}

// attempt to connect to WiFi network
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);
}

Serial.println("You're connected to the network");
printWifiStatus();

// start the web server on port 80
server.begin();
}

void loop()
{
// listen for incoming clients
WiFiEspClient client = server.available();
if (client) {
Serial.println("New client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
Serial.println("Sending response");

      // send a standard http response header
      // use \r\n instead of many println statements to speedup data send
      client.print(
        "HTTP/1.1 200 OK\r\n"
        "Content-Type: text/html\r\n"
        "Connection: close\r\n"  // the connection will be closed after completion of the response
        "Refresh: 20\r\n"        // refresh the page automatically every 20 sec
        "\r\n");
      client.print("<!DOCTYPE HTML>\r\n");
      client.print("<html>\r\n");
      client.print("<h1>Hello World!</h1>\r\n");
      client.print("Requests received: ");
      client.print(++reqCount);
      client.print("<br>\r\n");
      client.print("Analog input A0: ");
      client.print(analogRead(0));
      client.print("<br>\r\n");
      client.print("</html>\r\n");
      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(10);

// close the connection:
client.stop();
Serial.println("Client disconnected");

}
}

void printWifiStatus()
{
// print the SSID of the network you're attached to
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print your WiFi shield's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print where to go in the browser
Serial.println();
Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
Serial.println();
}`

this sketch after to modify the first parameter is ok. but the debug there is some issue. for example the firmware is not supported or TIMEOUT error and another. some time this sketch is ok, sometime doesn't work. Now, i can try to modify somenthing but nothing is true.

Can someone help me for resolve?! thanks so much!

@JAndrassy
Copy link

what firmware version? AT 2.0 will not work and with AT 1.7.x better use my WiFiEspAT library (if you don't need https)

@Pante90
Copy link
Author

Pante90 commented Jun 29, 2020

my version is this:
AT+GMR
AT version:1.6.2.0(Apr 13 2018 11:10:59)
SDK version:2.2.1(6ab97e9)
compile time:Jun 7 2018 19:34:26
Bin version(Wroom 02):1.6.2
OK

but i don't use WiFiEspAT library but use WiFiEsp library

@JAndrassy
Copy link

you wrote something about latest SDK. the latest NonOS SDK is version 3 and has AT version 1.7.4

@Pante90
Copy link
Author

Pante90 commented Jun 29, 2020

yes, before i install the latest SDK 3. but i think is wrong for the repost message that firmware is uncompatible, then i downgrade the firmware at this and the problem is the same.

@Pante90
Copy link
Author

Pante90 commented Jun 29, 2020

now i have this configuration:
AT+GMR
AT version:1.4.0.0(May 5 2017 16:10:59)
SDK version:2.1.0(116b762)
compile time:May 5 2017 16:37:48
OK

my out on serial monitor when i try to request the page is this:

[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] End tag not found
[WiFiEsp] Warning: Unsupported firmware
Attempting to connect to WPA SSID: Casa_Camera
[WiFiEsp] Failed connecting to Casa_Camera
Attempting to connect to WPA SSID: Casa_Camera
[WiFiEsp] Connected to Casa_Camera
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Server failed to start
[WiFiEsp] New client 1
New client
GET / HTTP/1.1
Host: 192.168.1.149
Connectioeipeces
-tzi.is1;�⸮
⸮ѱ⸮⸮⸮.V⸮rs=gar⸮
[WiFiEsp] TIMEOUT: 347
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] No tag found
Client disconnected
[WiFiEsp] New client 0
New client
GET / HTTP/1.1
Host: 192.168.1.049
Cookl
anru1ee a0dN.Wn)lK7 lW⸮⸮⸮⸮r⸮⸮⸮⸮
⸮⸮e⸮kJ
[WiFiEsp] TIMEOUT: 347
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] No tag found
Client disconnected
[WiFiEsp] New client 0
New client
GET / HTTP/1.1
Host: 192.168.1.149
ConnectioeiUdnes
rnMz5Ww 0
h⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮e˥Ѭ⸮⸮⸮⸮
[WiFiEsp] TIMEOUT: 342
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] No tag found
Client disconnected

@JAndrassy
Copy link

so use SDK3 AT 1.7.4 with my WiFiEspAT library. it is in Library Manager.
https://github.com/jandrassy/WiFiEspAT/blob/master/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants