This pages lists the extensions available in the version of uLisp for the ESP8266 and ESP32. For examples of their use see Wi-Fi examples.
Returns the number of bytes available for reading from the stream, or zero if no bytes are available.
Returns t or nil to indicate if the client on stream is still connected.
(wifi-connect [ssid password])
Connects to the wi-fi network ssid using password password. It returns the IP address as a string. It may take a few seconds to connect. For example:
> (wifi-connect "Geronimo" "topsecret") "10.0.1.28"
With no parameters wifi-connect disables the network connection.
Note that the ESP8266 stores the last used access point in EEPROM, so if it loses the connection for some reason it will reconnect to the last used access point once it is back online and you do not need to give a wifi-connect command again.
Returns the IP address of the local network as a string.
Starts a server running. It returns nil.
(wifi-softap ssid [password channel hidden])
Set up a soft access point to establish a Wi-Fi network. Returns the IP address as a string or nil if unsuccessful. For example:
> (wifi-softap "Buckyball") "192.168.4.1"
With one parameter ssid it sets up an open Wi-Fi network. One or more of the remaining parameters can be specified:
- Specify password to protect the network with a password.
- The channel is an optional channel, default 1.
- If hidden is set to non-nil the access point will be hidden.
With no parameters wifi-softap disables the currently-active soft access point.
with-client special form
(with-client (stream [address port]) form*)
The with-client form evaluates the forms with stream bound to a wifi-stream.
If address and port are specified, with-client allows you to communicate with the IP address defined by address and port. The address can be an integer representing a 32-bit IP address, or a string representing a domain name.
If with-client is called with just the stream parameter it allows you to communicate with a client connected to a server started with wifi-server. If there are no active clients with-client returns nil immediately without evaluating the forms.
In each case you can then use the standard uLisp I/O functions to write to or read from the stream. See Wi-Fi examples for examples of using with-client.