chunlinhan / WiFiRM04

Arduino WiFi library for Hi-Link HLK-RM04 module
37 stars 28 forks source link

Need help to connect with web #18

Open binu8051 opened 10 years ago

binu8051 commented 10 years ago

Hi I am using RM04 on my home automation system, its work fine in local network.

I want to get data from web. How it can be done? I am using 8051 microcontroller.

Just a hint is enough for me, i have attached the configuration screen shot of my wifi module.

Do i need to do this by using the AT Commands. if its through at commands what are the commands used to get the webpage of www.google.com

i tried to go through your code, but i cant since i am new to arduino. I am using Bascom BASIC for my 8051 and avr microcontroller.

Any help from your side is really appreciated.

Thanks Binu

chunlinhan commented 10 years ago

Hi Binu,

Check this library: https://gitcafe.com/winterland/wifi-duino/tree/master/wifiDuino This library should be more clear than mine for your application.

If you've set your RM04 well for Internet access, you could just call the following functions to get the http response from google:

wifiDuinoClass::startClient("www.google.com", "80"); wifiDuinoClass::sendHttpRequest("/", "www.google.com", HTTP_GET, false); wifiDuinoClass::waitHttpRespond(buf, buflen, -1);

Trace the above functions, you could know the AT commands you need and how to use them.

binu8051 commented 10 years ago

Thanks, will look over it.

binu8051 commented 10 years ago

Hi I tried it, everything was ok with me.

But the command mode is disconnected once i give the command "at+reconn=1"

Also its not getting the website data for the below command.

GET / HTTP/1.1 Host: google.com

I am using Hyper terminal to send the commands.

Thanks for your help

Binu

chunlinhan commented 10 years ago

Hi Binu,

After you send "at+reconn=1\r", RM04 will exit AT command mode and restart some daemons running inside RM04. So you need to wait those daemons to restart (it might take about 5 seconds) then send your HTTP GET request out.

binu8051 commented 10 years ago

Hi Thanks, got it. Binu