Advanced WX

BlocklyProp block reference for Advanced WX blocks

Use these with Parallax products containing an ESP8266 WX WiFi Module.

Compatible with the Activity Board WX, FLiP, Badge WX, and Other board types. 

The Simple WX blocks and Advanced WX blocks are NOT compatible with each other! 
A program that contains Advanced WX blocks cannot contain any Simple WX blocks, and a program that contains Simple WX blocks cannot contain any Advanced WX blocks.


Advanced WX initialize

This block launches one processor automatically.

The Advanced WX initialize block is required when using other WX advanced blocks on any board or device except the Badge WX.

Use the mode drop-down menu to determine where the Terminal output should be routed through (this is for any blocks using Terminal or Graphing). Text sent between the computer and your board/device can be routed through the USB cable or, in future BlocklyProp versions, the WX module:

  • Terminal on USB - only option currently supported.
  • Terminal on WX - NOT currently supported; use when programming the board via USB and using the Terminal or graphing via the WX module.
  • Terminal & Programming on WX - NOT currently supported; use when programming and using the Terminal or graphing via the WX module.

Use the DI (Data In) menu to select to which pin the DI pin of the WX module is connected. If you select a pin other than the WX socket, then a second DO (Data Out) menu will appear for you to define that pin connection as well.


Advanced WX connect

The Advanced WX connect block instructs the WX module to listen for incoming HTTP, WebSocket, or TCP data.

The WX module can listen for data from up to four sources. Therefore, this block can be used up to four times.

When it establishes a connection, the program stores the ID for this connection in the variable specified by the store ID in menu.

For each type of connection, you must specify a path as a string of text for the module to connect. For example, to connect to a web service via HTTP, you could use "http://blockly.parallax.com/blockly/ping" or the URL for your specific web service.

HTTP and WebSocket connections default to port 80. For TCP connections, an additional input will appear. You must specify this port as a number.


Advanced WX poll

The Advanced WX poll block instructs the WX module to check the connections set up by the Advanced WX connection block for any incoming data. If any data is received, then a character code for the event type is stored in the variable specified by the first drop-down:

  • 'G' (GET request)
  • 'P' (POST request)
  • 'W' (WebSocket connection request)
  • 'D' (Data ready)
  • 'S' (Successful reply or Send operation)
  • 'X' (Disconnect occurred)
  • 'N' (Nothing to report)
  • 'E' (Error)

The ID of the connection corresponding to the event code will be stored in the variable specified by the second drop-down menu.

A handle that can be used to retrieve any data from this poll will be stored as a number in the variable specified by the third drop-down menu.


Advanced WX print

The Advanced WX print block can print several terms of different types to the WX module. 

First, specify whether the information will be sent:

  • as an HTTP GET request
  • as a TCP packet
  • via a WebSocket
  • as a Command to the WX module

Next, specify the connection handle, retrieved by the Advanced WX poll, where you want the string of text sent.

Click the gear icon to drag additional terms into the list. Options are:

  • text
  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

This block works similarly to the Terminal print multiple shown in this video:

Floating point number option

BlocklyProp uses integer numbers. The floating point number option allows a program to display an integer value as a decimal number. Use its drop-down menu to divide the integer by a multiple of 10 to scale and display the number appropriately, as shown in the video below using the Terminal print multiple block.


Advanced WX send

The Advanced WX send block sends the attached string of text to a TCP connection specified by the handle provided.

The handle is one of the values retrieved by the Advanced WX poll block.


Advanced WX scan multiple

The Advanced WX scan multiple block scans the received string and stores the data extracted from the string as specified.

First, specify where the information has been retrieved from:

  • an HTTP POST request
  • a TCP packet
  • a WebSocket
  • the replay from a Command to the WX module

Next, specify the connection handle, retrieved by the Advanced WX poll, where the string of text should be sent.

Click the gear icon to drag additional terms into the list. Options are:

  • decimal number
  • hexadecimal number
  • binary number
  • floating point number
  • ASCII character

For POST requests, the name in the name/value pair should be specified in the "string starts with txt" parameter.


Advanced WX scan string

The Advanced WX scan string stores an incoming string in the specified variable.

First, specify whether information has been retrieved from:

  • an HTTP POST request
  • a TCP packet
  • a WebSocket
  • the replay from a Command to the WX module

Next, specify the connection handle, retrieved by the Advanced WX poll, where the string of text should be sent.

Lastly, specify the variable in which to store the string. 

If you are retrieving data from a TCP connection, you must store the string in the variable set at the WX buffer by the Advanced WX buffer block.    

String variables only store up to 64 characters by default. Use the Advanced WX buffer block (for TCP connections), or the String variable set size in the OPERATORS > STRINGS menu if you need to store a longer string.


Advanced WX receive

The Advanced WX receive block receives and stores an HTTP response header or data from a TCP or WebSocket connection.

First, specify the string variable in which to store the received string. 

String variables only store up to 64 characters by default.  Use the String variable set size in the OPERATORS > STRINGS menu if you need to store a longer string.

Next, specify the variable where the length of the received string will be stored.

Then, specify an active connection handle, retrieved by the Advanced WX poll.  

Lastly, make sure that the maximum bytes retrieved is long enough for the incoming string.


Advanced WX mode

The Advanced WX mode block sets or gets the current mode of the WX module.

  • AP mode sets the WX module to be a WiFi access point.
  • STA mode sets the WX module to be a WiFi station on an existing network.
  • AP + STA mode sets the WX module to behave as both a station and as an access point.

Advanced WX code

The Advanced WX code block provides the value for one of the codes used by the WX module.


Advanced WX buffer

The Advanced WX buffer block is used to set a receiving buffer. If you are not receiving all of the characters from an incoming stream of data, then you may need to increase the size of this buffer. 

Use only as much buffer space as you need. There is a limited amount of memory available on the Propeller, and issues such as program lockup may occur when string buffers use more memory than is available.


Advanced WX join network

The Advanced WX join network block allows you to join a WiFi network by specifying its SSID and that network's passphrase.


Advanced WX disconnect

The Advanced WX disconnect block disconnects the WX module from the specified connection.


Advanced WX IP address

The Advanced WX IP address block provides the IP address of the specified mode as a string. Because the WX module can be both a station and an access point, it may have separate IP addresses for each.