Post topics, source code that relate to the Arduino Platform

User avatar
By Linton_Samuel_Dawson
#26237 OK, from what I got from the guy running the server it's hosting different service on that, so the host header is mandatory..also, from the logs he gets this:
[My IP address here] - - [16/Aug/2015:23:29:20 +0000] "GET / HTTP/1.1\x5Cr\x5CnHost: coolparis.azundo.com\x5Cr\x5Cn\x5Cr\x5Cn" 400 173 "-" "-" "-"

The escape character got there wrong so my request gets messed up, and that should be the matter.
Any guess on why that's happening?
Maybe because I'm running from the serial monitor?
User avatar
By martinayotte
#26266 The 0x5C are backslash characters, so you are trying to escape some thing, but in fact your are sending those backslashes ...
Are you trying to send "\r\n" literally from the serial terminal ?
It needs to be done from a arduino sketch or from a script on your PC.
User avatar
By Linton_Samuel_Dawson
#26298 Ok, so that was the problem all the time... had no experience with serial communication...

yeah, I was using the serial monitor to be sure to get my commands list and my GET request right before making a sketch to upload...

anyway, now it works:

Code: Select allOK
AT+CIPSEND=2,53


OK
> GET / HTTP/1.1
Host: coolparis.azundo.com

busy s...

SEND OK

+IPD,2,169:HTTP/1.1 200 OK
Server: nginx/1.0.12
Date: Mon, 17 Aug 2015 21:56:34 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 8
Connection: keep-alive

18;18;182,CLOSED


just to be sure and lose another week on thin air..
can I keep using the hardware serial port, so pins 0 and 1, or I should switch to software serial?
the commands must be like "Serial.print("AT\r\n"), right?
what would you suggest to use to to get the data (18,18,18 in this case) to a string?

again, dumb questions but I still need to get the hang of serial communication with this thing...
User avatar
By martinayotte
#26300 Good ! you've now few steps further !

For Serial.print("AT\r\n"), yes, you're right, in a sketch, the escaping is required.

I'm not sure that I understand your next question ...
You accumulate characters from serial, when seeing "+IPD,2,", you then look for character count 169 followed by :, then you continue to accumulate characters until 169 characters are received. Then you need to parse last line to exctract the numbers.

What do you mean by "hang" ? after receiving the answer, you are not able to type a new GET request ? strange ...

By the way, do you really need to have a ESP with a separate Arduino in your project ? What the Arduino is used for ?
Because you can use ArduinoIDE for ESP and do all the same job much more easily with a HTTPClient sketch instead of having all those AT commands with answer parsing ... (Keep your Arduino for other project)