gpio 0.2.0
gpio: ^0.2.0 copied to clipboard
Linux GPIO from pure Dart over the /dev/gpiochip v2 ABI — no native library. Kernel debounce, edge-event streams with kernel timestamps, and dropped-edge detection.
Examples #
Both take an optional chip label and line offset:
dart run example/blink.dart pinctrl-rp1 17
dart run example/button.dart pinctrl-rp1 17
Defaults are pinctrl-rp1 (a Raspberry Pi 5) and line 17. Find your chip's
label with gpiodetect, or from Dart:
for (final chip in GpioChip.list()) {
print('${chip.info.name}: ${chip.info.label} (${chip.info.lineCount} lines)');
chip.close();
}
| example | what it shows |
|---|---|
blink.dart |
claiming an output, driving it, releasing it cleanly |
button.dart |
pull-up + activeLow, kernel debounce, the edge-event stream, and reacting to dropped edges |
Both need access to /dev/gpiochip* — see the udev rule in the top-level
README, or run them as root.