External Links

Creative Science Centre


Library WiFi

// #include "http://www.byvac.com/mBlib/flb/Library/2016/lib_wifi.bas"

This is based on the ESP8266. ByPic devices have two UARTS. UART2 is the main communication UART and UART1 is the spare. If the WiFi is connected to UART2 then it acts as a virtual COM port, very useful for remote programming, no library is needed. Also this mode allows the WEB IDE to be used.

If connected to UART1 it is more versatile for WEB API applications and this library is needed. In addition the library can also be used if UART2 is connected for gaining access to web API's etc.

Summary: The library will allow access to web API's and pages, time etc. for either UART1 or UART2, however for more reliable result when accessing the web, UART1 should be used as this does not share the interface with the main command processor.

The latest ESP226 firmware and details of how to program into various devices.


The UART (1 or 2) and device needs specifying in wifi.start, e.g. wifi.start(*BV507(),2). The types implemented are at the top of the library.

Not all functions are listed here, see inside library for more details

  • com.see() // prints out contents of com buffer (only applies when using UART1)
  • com.see1() // as above but does not destroy buffer
  • com.mopup(timeout) // use with UART2 t mop up any stray bytes that may cause ERROR<0>
  • com.waitfor(this$,maxTime) // waits for string to arrive in buffer, returns bytes after that
  • com.get$() // returns com buffer
  • com.get1(*string$) // gets com buffer into string$ - for larger input
  • wifi.check() // returns 1 if connected and working
  • wifi.cmd$(cmd$) // send command, e.g. print wifi.cmd$("info")
  • wifi.sendGetRequest(host$[40],req$,port,waitfor$[40])
  • wifi.dt$() // returns data and time from google


When using on UART2, because it shares communication with the main interface (ok prompt), consideration needs to be taken of how the prompt will react to returned text.