Использование C++ и libgpiod V1:
Код: Выделить всё
try {
gpiod::chip chip("gpiochip0");
gpiod::line_bulk lines;
const std::vector offsets = {
{1, 21},
{2, 26},
{3, 16},
{4, 19}};
for (io_gpio_t offset : offsets) {
auto line = chip.get_line(offset.gpio_line);
line.set_bias(gpiod::line::bias::pull_up); //
Подробнее здесь: [url]https://stackoverflow.com/questions/78381572/how-do-i-set-the-internal-pull-up-of-a-given-line-on-a-raspberry-pi-4[/url]
Мобильная версия