Component: WIFI (BL0136) (E-blocks 2): Difference between revisions
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;"" to "width="10%" align="center" class="mtx-class-macrohead"" |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 136: | Line 136: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForPageRequests''' | ||
|- | |- | ||
| colspan="2" | To be called periodically. Returns non-zero if a request has been processed | | colspan="2" | To be called periodically. Returns non-zero if a request has been processed | ||
| Line 150: | Line 150: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckTCPServerIP''' | ||
|- | |- | ||
| colspan="2" | Collects the local IP address of the active TCP server. | | colspan="2" | Collects the local IP address of the active TCP server. | ||
| Line 164: | Line 164: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ClientConnect''' | ||
|- | |- | ||
| colspan="2" | Creates a TCP or UDP connection to a remote server. Returns the state of the connection. 0=Connection failed 1=Connection active | | colspan="2" | Creates a TCP or UDP connection to a remote server. Returns the state of the connection. 0=Connection failed 1=Connection active | ||
| Line 193: | Line 193: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ClientSendArray''' | ||
|- | |- | ||
| colspan="2" | Sends out an array of data bytes with the required AT+CIPSEND=Length$(Request) initialiser. | | colspan="2" | Sends out an array of data bytes with the required AT+CIPSEND=Length$(Request) initialiser. | ||
| Line 217: | Line 217: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ClientSendRequest''' | ||
|- | |- | ||
| colspan="2" | Sends out a string with the required AT+CIPSEND=Length$(Request) initialiser. | | colspan="2" | Sends out a string with the required AT+CIPSEND=Length$(Request) initialiser. | ||
| Line 236: | Line 236: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ConnectToSSID''' | ||
|- | |- | ||
| colspan="2" | Attempts to connect to the given SSID and Key values. Returns 1 if the SSID has been connected. | | colspan="2" | Attempts to connect to the given SSID and Key values. Returns 1 if the SSID has been connected. | ||
| Line 265: | Line 265: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ControlTCPServer''' | ||
|- | |- | ||
| colspan="2" | Allows a TCP web page server to be switched on and off on the selected port. Returns 1 if the command was completed correctly. | | colspan="2" | Allows a TCP web page server to be switched on and off on the selected port. Returns 1 if the command was completed correctly. | ||
| Line 289: | Line 289: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CreateAccessPoint''' | ||
|- | |- | ||
| colspan="2" | Sets up the wireless LAN module into AP mode to host a wireless network. Other WIFI enabled devices can then connect to the module. Returns 1 for success. | | colspan="2" | Sets up the wireless LAN module into AP mode to host a wireless network. Other WIFI enabled devices can then connect to the module. Returns 1 for success. | ||
| Line 323: | Line 323: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''DisconnectFromSSID''' | ||
|- | |- | ||
| colspan="2" | Disconnects from the current SSID. Returns 1 if the command was accepted and returned an "OK" | | colspan="2" | Disconnects from the current SSID. Returns 1 if the command was accepted and returned an "OK" | ||
| Line 337: | Line 337: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''EndServerConnection''' | ||
|- | |- | ||
| colspan="2" | Disconnects from the current active TCP/IP pipe. | | colspan="2" | Disconnects from the current active TCP/IP pipe. | ||
| Line 351: | Line 351: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetByteWithTimeout''' | ||
|- | |- | ||
| colspan="2" | Attempts to receive a byte from the circular buffer. If nothing is available then waits up to 200 ms for data to become available. | | colspan="2" | Attempts to receive a byte from the circular buffer. If nothing is available then waits up to 200 ms for data to become available. | ||
| Line 365: | Line 365: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetFirmwareVersion''' | ||
|- | |- | ||
| colspan="2" | Collects the firmware version from the ESP8266 module and returns it as a string. | | colspan="2" | Collects the firmware version from the ESP8266 module and returns it as a string. | ||
| Line 379: | Line 379: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetInValue''' | ||
|- | |- | ||
| colspan="2" | Returns the string value of a Request parameter | | colspan="2" | Returns the string value of a Request parameter | ||
| Line 398: | Line 398: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetRxArray''' | ||
|- | |- | ||
| colspan="2" | Attempts to receive a number of bytes from the remote connection If nothing is available then waits up to 200 ms for data to become available. Returns the number of bytes received,. | | colspan="2" | Attempts to receive a number of bytes from the remote connection If nothing is available then waits up to 200 ms for data to become available. Returns the number of bytes received,. | ||
| Line 422: | Line 422: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Initialise the device with the property data. Returns 1 if "ready" message successfully received Returns 0 if no reply from module | | colspan="2" | Initialise the device with the property data. Returns 1 if "ready" message successfully received Returns 0 if no reply from module | ||
| Line 436: | Line 436: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadEncryptionModeFromScan''' | ||
|- | |- | ||
| colspan="2" | Collects one of the encryption modes from the last SSID Scan. The ScanForSSID macro must be called first. 0=Open, 1=WEP, 2=WPA_PSK, 3=WPA2_PSK, 4=WPA_WPA2_PSK | | colspan="2" | Collects one of the encryption modes from the last SSID Scan. The ScanForSSID macro must be called first. 0=Open, 1=WEP, 2=WPA_PSK, 3=WPA2_PSK, 4=WPA_WPA2_PSK | ||
| Line 455: | Line 455: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadSSIDFromScan''' | ||
|- | |- | ||
| colspan="2" | Collects one of the SSID name strings from the last SSID Scan. The ScanForSSID macro must be called first. | | colspan="2" | Collects one of the SSID name strings from the last SSID Scan. The ScanForSSID macro must be called first. | ||
| Line 474: | Line 474: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadSignalStrengthFromScan''' | ||
|- | |- | ||
| colspan="2" | Collects the signal strength from the last SSID Scan. The ScanForSSID macro must be called first. Value returned is in negative dB, smaller value = better signal | | colspan="2" | Collects the signal strength from the last SSID Scan. The ScanForSSID macro must be called first. Value returned is in negative dB, smaller value = better signal | ||
| Line 493: | Line 493: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ScanForSSID''' | ||
|- | |- | ||
| colspan="2" | Checks for wireless networks in the local area which are broadcasting their SSID. Must not be connected to a network to allow this to function. Returns the number of wireless networks found, max 8. | | colspan="2" | Checks for wireless networks in the local area which are broadcasting their SSID. Must not be connected to a network to allow this to function. Returns the number of wireless networks found, max 8. | ||
| Line 507: | Line 507: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SendString''' | ||
|- | |- | ||
| colspan="2" | Sends the given Text with no preappendment. Useful for sending preformatted command strings. Appends a CR to the end of the string if SendCR is greater than 0. | | colspan="2" | Sends the given Text with no preappendment. Useful for sending preformatted command strings. Appends a CR to the end of the string if SendCR is greater than 0. | ||
| Line 531: | Line 531: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Send_Embedded_HTML_Page1''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 545: | Line 545: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Send_Embedded_HTML_Page2''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 559: | Line 559: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Send_Embedded_HTML_Page3''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 573: | Line 573: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Send_Embedded_HTML_Page4''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 587: | Line 587: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetOutValue''' | ||
|- | |- | ||
| colspan="2" | Set the value of an outbound substitution string | | colspan="2" | Set the value of an outbound substitution string | ||
| Line 612: | Line 612: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | WIFI Properties | ||
|- | |- | ||
|- | |- | ||
| Line 639: | Line 639: | ||
| colspan="2" | Older versions of the firmware require \r to terminate a AT command string. Newer versions of the firmware have changed to use \r\n termination. | | colspan="2" | Older versions of the firmware require \r to terminate a AT command string. Newer versions of the firmware have changed to use \r\n termination. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 688: | Line 688: | ||
| colspan="2" | Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled. | | colspan="2" | Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | HTML Source | ||
|- | |- | ||
|- | |- | ||
| Line 747: | Line 747: | ||
| colspan="2" | HTML content for webpage 4 | | colspan="2" | HTML content for webpage 4 | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Substitutions | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Outgoing | ||
|- | |- | ||
|- | |- | ||
| Line 765: | Line 765: | ||
| colspan="2" | Number of bytes to reserve for data string. | | colspan="2" | Number of bytes to reserve for data string. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Incoming | ||
|- | |- | ||
|- | |- | ||
| Line 779: | Line 779: | ||
| colspan="2" | Number of bytes to reserve for data string. | | colspan="2" | Number of bytes to reserve for data string. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:37, 13 July 2026
| Author | Matrix Ltd. |
| Version | 2.1 |
| Category | E-blocks 2 |
WIFI component
Wireless LAN component designed to work with the ESP-12S module. Provides a very simple interface to allow webpages to be hosted from hardware or simulation. Also available in the form of the BL0136 WIFI E-block.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_EBlocks2_WLAN_ESP12S_BL0136.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_EBlocks2_WLAN_ESP12S_BL0136.fcfx
Detailed description
No detailed description exists yet for this component
Examples
The examples below are all done using a EB091 board as the host
The EB069 ESP8266 Wifi E-block is connected to PORTD 0-7 with the patch setting set to B.
The EB005 LCD E-block is connected to PORTB 0-7 with the patch setting set to Default.
Other host boards are compatible with the examples, simply change the target chip and component connection properties.
Firmware Test
This example collects the firmware version from the ESP8266 module and displays it on an LCD. Tested working with firmware version 00150900.
Wireless Scanner
This example scans for wireless networks in range and prints the network IDs to the LCD along with the signal strength and security type.
Creating An Access Point
This example creates an access point you can connect your phone or laptop to named Flowcode_ESP8266. The password to connect to the access point is flowcode6.
Note this example simply creates an access point, no data is transferred.
Joining An Access Point
This example joins an existing access point. The network ID and Password must be altered to match your local WIFI network settings.
Note this example simply joins an access point, no data is transferred.
TCP Client
This example joins an existing access point. The network ID and Password must be altered to match your local WIFI network settings.
Once joined to the network the example connects to the MatrixTSL website and requests a file which is printed out on the LCD.
TCP Server
This example creates an access point you can connect your phone or laptop to named Flowcode_ESP8266. The password to connect to the access point is flowcode6.
Once the access point is created the example shows the server IP address on the LCD. Connecting to the wireless network on your phone or laptop and visiting the IP address shown on the LCD using a web browser allows you to switch LED outputs on and off.
Network Comms
Here are some examples using the Network Communication component linked to the ESP8266 component.
NetworkComms ESP8266 Webserver
Macro reference
CheckForPageRequests
| CheckForPageRequests | |
| To be called periodically. Returns non-zero if a request has been processed | |
| Return | |
CheckTCPServerIP
| CheckTCPServerIP | |
| Collects the local IP address of the active TCP server. | |
| Return | |
ClientConnect
ClientSendArray
| ClientSendArray | |
| Sends out an array of data bytes with the required AT+CIPSEND=Length$(Request) initialiser. | |
| Data | |
| NumBytes | |
| Return | |
ClientSendRequest
| ClientSendRequest | |
| Sends out a string with the required AT+CIPSEND=Length$(Request) initialiser. | |
| Request | |
| e.g. "GET / HTTP/1.0\r\n\r\n" | |
| Return | |
ConnectToSSID
ControlTCPServer
CreateAccessPoint
DisconnectFromSSID
| DisconnectFromSSID | |
| Disconnects from the current SSID. Returns 1 if the command was accepted and returned an "OK" | |
| Return | |
EndServerConnection
| EndServerConnection | |
| Disconnects from the current active TCP/IP pipe. | |
| Return | |
GetByteWithTimeout
| GetByteWithTimeout | |
| Attempts to receive a byte from the circular buffer. If nothing is available then waits up to 200 ms for data to become available. | |
| Return | |
GetFirmwareVersion
| GetFirmwareVersion | |
| Collects the firmware version from the ESP8266 module and returns it as a string. | |
| Return | |
GetInValue
| GetInValue | |
| Returns the string value of a Request parameter | |
| index | |
| Index of the request paramter, starting at zero Range 0-2 | |
| Return | |
GetRxArray
Initialise
| Initialise | |
| Initialise the device with the property data. Returns 1 if "ready" message successfully received Returns 0 if no reply from module | |
| Return | |
ReadEncryptionModeFromScan
ReadSSIDFromScan
| ReadSSIDFromScan | |
| Collects one of the SSID name strings from the last SSID Scan. The ScanForSSID macro must be called first. | |
| Index | |
| SSID Index | |
| Return | |
ReadSignalStrengthFromScan
ScanForSSID
SendString
Send_Embedded_HTML_Page1
| Send_Embedded_HTML_Page1 | |
| Return | |
Send_Embedded_HTML_Page2
| Send_Embedded_HTML_Page2 | |
| Return | |
Send_Embedded_HTML_Page3
| Send_Embedded_HTML_Page3 | |
| Return | |
Send_Embedded_HTML_Page4
| Send_Embedded_HTML_Page4 | |
| Return | |
SetOutValue
| SetOutValue | |
| Set the value of an outbound substitution string | |
| index | |
| Range 0-4 | |
| value | |
| Return | |