2017-12-19 02:53 AM
I have to use the SPWF01S module to do a remote control by means a smartphone. The
SPWF01S module communicates via UART with
an electronic board connected to an asynchronous motor. I want to send to the electronic board the START, STOP, DIRECTION and SPEED commands and I want to read cyclically the motor status (SPEED and other parameter). In the future I'm going to use a custom smartphone app but for the moment I will use the browser web page.I followed the 'wifi Training - Hands On - FW3.5.pdf' and the 'AN4902' application note by ST. Now I can send a chars string to the module but I don't know how to read CYCLICALLY
the data from the module. I read that #input SSI command allows to receive a chars string from the module. Using the 'input_demo.shtml' page I managed to receive a chars string from the module after pushing the 'Submit' button. In my case don't need the 'Submit' button because I have to read cyclically. Can you tell me how to do to read cyclically every (for example) 100 milliseconds?
Thanks
2017-12-19 04:35 AM
Basically you need a server, and your smartphone will connect to module to exchange data. You can decide to:
Case number 1 is what you already know. Use input_demo and output_demo.
Case number 2 is the most simple case, BUT you need to develop on smartphone an ad-hoc APP.
Case number 3 is probably what you need. Once smartphone connected to module by standard web Browser, you can send/receive data without AT commands. It's a simple cable replacement called 'Data Mode'. BUT in this case your external host needs to parse the HTTP request, and reply accordingly with 200 OK etc...
2017-12-19 06:26 AM
At the moment I can use the case number 1. How can I do a cyclically read?
Thanks.
2017-12-20 03:15 AM
Hello.
To read cyclically the data from the WiFi module, my idea is to modify the 'input_demo.shtml' file (below), by removing the 'radio' and 'submit' input tag and adding a javascript function that periodically sends a GET request to the 'input.cgi' script stored on the server. Is it possible to do this?
Is there any document where is explained how to use the 'input.cgi' and 'output.cgi' script? Are they modifiable? Have they any parameter that must be passed?
Thanks
input_demo.shtml
<html>
<head><title>Input Demo</title></head> <body bgcolor='white' text='black'> <p>Input from Host: <!--#input--> </p> <p> <br/><br/>Again?<br/> <form name='CGI Uart' method='GET' action='/input.cgi'> <input type='radio' name='input' value='on'/>Yes, one more time. Please<br/> <input type='radio' name='input' value='off'/>No, thanks. Bring me to HomePage<br/> <input type='submit' name='submit' value='Submit' > </form> </p> </body> </html>2017-12-20 04:21 AM
Input/output demos are based on simple HTTP GET requests. So, you need to trigger internal webserver with a new request every time you want to push/pop some data. You can do it cyclically (send a new request as soon as the previous one was completed), but it really depends on expected rate for requests. Be prepared to switch to case 2 or 3...
Take a look at
2017-12-22 06:07 AM
I'm tinking to modify the
input_demo.shtmland
output_demo.htmlfiles and make my
input_demo_my.shtmland
output_demo_my.html files leaving unchanged the part relating to the #input SSI command. I read in the AN4902 it is possible to store the new files in theexternalflash (while the input_demo.shtmland
output_demo.htmlare in the
internalflash ) . In this case, if I send thehttps://community.st.com/external-link.jspa?url=http%3A%2F%2F
<<ip address>>/input.cgi?input=on&submit=Submit
URL which file does it answer to the http request,
input_demo.shtmlor
input_demo_my.shtml?
Thanks