-->
Page 1 of 5

Serial Data transfer

PostPosted: Tue Oct 13, 2015 4:12 pm
by grchild@shaw.ca
I am trying to use the esp8266 as access point that I can use a browser on a smart phone to read a temperature sensor. The single temperature sensor serial data will be coming from a PIC so I can format it any way to make it work the easiest. The Data will be updating second or so I would like to have the page update automatically rather than having to refresh it all the time. There would only be the words`TEMPERATURE`and a reading with 1 decimal point, but I would like it to come upin large text. Im comfortably with microchip pics and basic but have no c experience and my networking and HTML skills are not to sharp. I was extremly happy to see there is a basic interpreter. I have some of adafruits HUZZAH 8266 modules. I loaded it with some C code from a AP example from Sparkfun and with a bit of playing got it to bring up a demo screen. I would rather do this in basic where I am more comfortable. If someone could tell me if I can accomplish this in basic and point me in the right direction I would really appreciate it

Re: Serial Data transfer

PostPosted: Tue Oct 13, 2015 5:21 pm
by Mmiscool
The code below will do the following.

The web page will refresh every 5 seconds and prompt on the serial every 5 seconds.

Please note that serial is blocking so you should respond to the serial with the temperature after each prompt.

The serial works on 9600 baud so connect to it using your terminal and see what it spits out to format your pic code accordingly.

You should also update to the latest version as I had to do a bug fix for this code to work.

I just posted the new version so if you go to the download page it will be up to date.


Code: Select allbla = 0
timer 5000 [update.Values]
wprint |<meta http-equiv="refresh" content="10; url=./input" />|
wprint htmlvar(bla)
button "this is a test" [test.1]
wait
[test.1]
wprint "test 1 was clicked"
wait
[update.Values]
input "enter value" bla
wait

Re: Serial Data transfer

PostPosted: Wed Oct 14, 2015 12:16 pm
by grchild@shaw.ca
Thanks for the the reply. Code looks really simple. I'll give it a go tonight. Is there anyway with code that I can make the text larger on the browser.

Re: Serial Data transfer

PostPosted: Wed Oct 14, 2015 3:26 pm
by xtal
can you explain the code ----????? I don't understand it all....
Code: Select allbla = 0                                       --- ok thats the var  the serial input goes into ,, will it contain crlf ??

timer 5000 [update.values]                    --- when 5 sec passed goto [update.values]   
                                              --- does code continue to run  or wait here  for 5 sec ????

wprint <meta>~~~~~~~~~~~~url=./input  />      ---  What does     url=./input /          do?????
wprint htmlvar(bla)                           ---  this apparently is continuation of the W page
                                              ---  how would I place this at a different location in W page ??
                                              ---  can this easily be a JAVA VAR  ??????? that the W page can perform actions on
button "this is a test" [test.1]              ---  W page continuation  jump to [ test 1] when button clicked ??????
wait                                          --- wait here until button is clicked ???????
[test.1]
Wprint "test 1 was clicked"                   --- ??? this appears on W page @ next refresh
wait                                         --- ??? what is this waiting on   ?????
[update.values]
input "enter value" bla                      ---   receive serial input , save in bla  var
wait                                         ---  ??? wait crlf on serial input  ???

 ?????  I guess this all  repeats ???????