Pixelblaze Advanced Features. 

 
 

Connecting a Button

Pixelblaze supports a button on pin 0. This pin has a pull-up resistor, and when shorted to ground momentarily will change the pattern. If pressed for more than 3.5 seconds, it will put Pixelblaze into WiFi setup mode. 

To wire a button, connect the top pin and the bottom pin to the button. 

Websocket API

Pixelblaze is controlled by a websocket connection on port 81. JSON and binary frames are sent to control and edit the patterns.

Getting and Setting Variables

If your expression uses but does not initialize some variables, you can control these over the network using the websocket. Send a JSON text frame like this:


{
	"setVars": {
		"myVar": 3.14159,
		"var2": 42
	}
}

To get variables, send a frame like this:


{
	"getVars": true
}

And you'll get a response with all variables. Note that this will only show variable state AFTER the last pixel has been rendered. 


{
	vars: {
		"myVar": 3.14159, 
		"var2": 42,
		...
	}
}

Listing Patterns


{
	"listPrograms": true
}

The pattern list returned contains the name and id, along with some other fields about storage space in memory.


{
	"programList": [
		{
			"name": "my pattern",
			"id": "x1234567890",
			"sourceSize": 123,
			"globalSourceSize": 123,
			"compiledSize": 134,
			"imgSize": 5123
		}, ...
	]
}

Changing The Active Pattern

With a pattern ID handy, you can activate any previously stored pattern. This change is saved and will persist if the device restarts. 


{
	"activeProgramId": "x1234567890"
}