← All scene elements
SCENE ELEMENT / 15

GPIO

Raspberry Pi inputs and outputs through libgpiod.

LIVE WEB PLAYER

See it respond.

The same raylib runtime, compiled to WebAssembly. Load this example, inject MQTT messages and watch its published events.

Loading WebAssembly…
MQTT I/O
Waiting for runtime…

The browser requires a user action before the scene is loaded. Click Load demo scene first. MQTT is emulated and never leaves this page. Shaders are disabled in the web build; GPIO is hardware-only.

Raspberry Pi GPIO input/output using libgpiod. Available only in builds configured with ERGS_PLATFORM_RPI=ON.

Configuration

FieldDescription
typegpio
pinBCM GPIO number
chipgpiochip number, default 0
modeinput, input_pullup, or output
invertInvert physical/logical state
initialInitial output state
on_press, on_releaseInput-mode action chains

Copy-and-paste JSON

json
{
  "type": "gpio",
  "id": "physical_choice_a",
  "pin": 23,
  "chip": 0,
  "mode": "input_pullup",
  "invert": true,
  "on_press": "status_text.set('GPIO A')"
}

Output example:

json
{
  "type": "gpio",
  "id": "status_lamp",
  "pin": 18,
  "mode": "output",
  "initial": "OFF"
}

MQTT

text
Published input state: ergs/rpi01/status/physical_choice_a   ON
Set output:           ergs/rpi01/update/status_lamp          ON