Table of Contents
This endpoint provides access to the GPIO pins of the player. It is required that the GPIO feature is enabled for the player, under the Interactivity
Settings tab.
Please note that the pins are not numbered numerically but using the Broadcom SoC numbering. For more info about the player GPIO layout and technical details, please refer to our GPIO guide. If you want a usage example, check out our reference GPIO App.
Configuring the pins
Method: POST
Path: /gpio/config
Body: <your_config>
Response Code: 200
Apply a pin configuration to the GPIO board. The request should have a Content Type of application/JSON. The JSON must have a “config” key that contains a dictionary where the pins are configured separately.
For the configuration of a pin, use its pin number as the key and a dict of configuration values. You must specify an operation mode for the pin, under the "mode"
key, as either "input"
or "output
“. For input
pins, you must also specify the pull-up-down resistor configuration, under the pud
key, as either up
or down
. We recommend using pins 4-27.
In order to reset the configuration, supply an empty dictionary under the "config"
key.
Here is a configuration example:
{
"config": {
"4": {"mode": "input", "pud": "down"},
"5": {"mode": "output"}
}
}
Data input and output
Method: POST
Path: /gpio/io
Body: <your_io>
Response Code: 200
Perform IO on GPIO pins. The pins must already be configured in order to perform any IO action. The request should have a Content-Type of application/json and must contain the following information.
For input pins, you should use the "reads"
key to supply a list of their PIN numbers.
For output pins, you should use the “writes” key to supply a dictionary where the pin number is the key, and you must specify an output value as either 0
or 1
.
Here is an IO example:
{
"reads": ["4"],
"writes": {"5": 1}
}