SolarOS

SolarOS 4.6.8 manual · hardware

GPIO, ADC, PWM, and LED APIs

SolarOS exposes only runtime-safe pins for the active board. Never copy a GPIO number from another ESP32 board or assume that a header pin is unclaimed.

Discover first

import solaros

for pin in solaros.gpio.pins():
    print(pin)

Check allowed(pin) before configuring a pin. Release a claimed pin when the script is done so another service can use it.

Digital output

pin = 1
if solaros.gpio.allowed(pin):
    solaros.gpio.mode(pin, solaros.gpio.OUTPUT)
    solaros.gpio.write(pin, 1)
    solaros.gpio.release(pin)

Use the documented mode and pull constants. Do not replace them with guessed strings or integers.

Quick reference

Inspect solaros.gpio.pins() and allowed(pin) before use; never invent safe GPIO numbers. GPIO offers mode or configure, read, write, and release plus INPUT, OUTPUT and pull constants. solaros.led offers status, set, on, off, toggle. solaros.adc offers pins and read. solaros.pwm offers status, set(pin, frequency, duty_percent), and off. APIs are package-gated.