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

Welcome Guest. Please Login or Register.
Jan 22nd, 2018, 12:02am

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 513 times)
Team Liberty BASIC

member is offline


Homepage PM

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

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.

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.
print wget$("")

function wget$($)

	wget$ = shell$("wget ";chr$(34);$;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
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