I have an Arduino Uno and for Wifi an ESP8266.
My ESP8266 Firmware is
AT+GMR
AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
baund = 115200,
Both NL & CR
Server -- www.linysoft.com
The URL I want to send is either: http://www.linysoft.com/arduino/?light=off
OR http://www.linysoft.com/arduino/?light=on
.
Depending on to the link I send the result should be either ==> on or ==> off on the page http://www.linysoft.com/arduino/light.json
.
Now I want to send an HTTP request (Weblink - http://www.linysoft.com/arduino/?light=on
) so it can write according to that link "on" in the light.json
page.
The AT command I am sending (my wifi module is connected to my wifi automatically):
WIFI CONNECTED
WIFI GOT IP
AT+CWMODE=1
OK
AT+CIPMUX=1
OK
AT+CIPSTART=0,"TCP","www.linysoft.com",80
0,CONNECT
OK
AT+CIPSEND=0,200
OK
>
Here I am getting a problem after this> I can't send **GET /arduino/?light=on**
. I also tried GET /arduino/?light=on HTTP/1.0\r\n
.
After putting this line in the textbox, I press the Enter button or Send Button, but nothing happens.
It is stuck here> for some time. And then it shows me:
OK
> 0,CLOSED
Pin Connection
ARDUINO UNO ESP8266
RX --------------> TX
TX --------------> RX
VCC--------------> 3.3
CH_PD ----------> 3.3
GND -------------> GND
-
What technology are you using to connect to the Internet, and hence to "www.linysoft.com"? How have you checked that WiFi access point, and internet connection works?gbulmer– gbulmer2016年01月10日 15:32:10 +00:00Commented Jan 10, 2016 at 15:32
-
Is there other solution to these problem ?user25837– user258372016年08月17日 11:25:43 +00:00Commented Aug 17, 2016 at 11:25
4 Answers 4
linysoft.com is a virtual host. Just try going to http://100.42.56.28/ and see that the connection is reset.
So after the GET /arduino/?light=on
, you have to also send Host: www.linysoft.com
(on the next line).
The domain is missing. Try this instead:
GET http://www.linysoft.com/arduino/?light=on HTTP/1.0\r\n\r\n
Cheers!
-
I didn't know that was allowed in HTTP, as browsers use the
Host
header. But apparently using an absoluteURI is allowed.Gerben– Gerben2016年01月10日 16:29:00 +00:00Commented Jan 10, 2016 at 16:29
Just found out a POST wouldn't work. Try this GET request to turn on the light.
GET /arduino/?light=on HTTP/1.1\r\nHost: www.linysoft.com\r\n\r\n
Then you can get the status of the LED by GETting light.json like this:
GET /arduino/light.json HTTP/1.1\r\nHost: www.linysoft.com\r\n\r\n
I was having same problem and this one solved the problem that after you get a '>' sign then write
GET http://linysoft.com/arduino?light=on HTTP/1.0\r\n\r\n(or if you are directly writing this on serial monitor then press enter key twice and then wait for somemoment like 2-3 sec in this case dont put \r\n\r\n)
If this didnt worked then try GET http://linysoft.com/arduino/?light=on HTTP/1.0\r\n\r\n
But in this I guess you need to specify arduino.php or arduino.html whichever type you have and too you have to take care the cipsend should be the byte no of get request excluding \r\n\r\n and add 4 to it because we are too sending \r\n\r\n these are 4 character
I hope this will surely work for you