Liberty BASIC Community Forum
« ESP8266 WIFI GPIO in basic controlled from LB »

Welcome Guest. Please Login or Register.
May 28th, 2017, 10:49pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: ESP8266 WIFI GPIO in basic controlled from LB  (Read 346 times)
mmiscool
Team Liberty BASIC


member is offline

Avatar



AIM
Homepage PM

Gender: Male
Posts: 224
xx ESP8266 WIFI GPIO in basic controlled from LB
« Thread started on: Nov 4th, 2015, 10:37pm »

Hello,
Been absent from the forum for a little while but haven't forgotten.

Been delving head first in to the internet of things world and developing a basic interpreter modeled on RUNBasic to run on the ESP8266. With that in mind a wifi device with out a PC or other computer to communicate with is no fun especially if you wanted to make you home automation control center using liberty basic or run basic.

I have posted up an example on the web site for how to make the device usable for GPIO operations over wifi and am posting the liberty basic specific code to interface with it here. The ESP8266 must first be flashed with "ESP8266 Basic" firmware and the example program from the following page should be uploaded to the device. Once this is done you can control the I/O pins on the device in liberty or run basic with a couple of small functions.

Code to be put on the ESP and the wget program to tug its URLs and make the magic happen.
http://www.esp8266basic.com/msg-url-advanced.html


Liberty Basic Code to control the device. You will have to put in the ip address of the device you want to control and modify the url accordingly to control each of the functions available in the script on the device.
Code:
print wget$("http://192.168.4.1/msg?pin=2&stat=1&action=po")
end




function wget$(page.to.get$)

	wget$ = shell$("wget ";chr$(34);page.to.get$;chr$(34);" -q -O -")

end function


function shell$(command$)
    open "msvcrt" for dll as #msvcrt
    command$ = command$ + " > %temp%\lbbcmd.out"
    calldll #msvcrt, "system", command$ as ptr, r as long
    close #msvcrt
    tmp$ = space$(260)
    calldll #kernel32, "GetTempPathA", 260 as long, tmp$ as ptr, r as long
    open left$(tmp$,r) + "lbbcmd.out" for input as #tmp
    shell$ = input$(#tmp, lof(#tmp))
    close #tmp
end function 
User IP Logged

http://mmiscool.com
http://esp8266basic.com
http://smbisoft.com
michael
Guest
xx Re: ESP8266 WIFI GPIO in basic controlled from LB
« Reply #1 on: Nov 21st, 2015, 2:05pm »

Impressive work.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls