mirror of
https://github.com/EmbedDevIOT/obsidian-vault-.git
synced 2026-11-06 02:13:27 +03:00
vault backup: 2026-03-04 22:40:14
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
#include <libgpiod>
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
struct gpiod_chip *chip;
|
|
||||||
struct gpiod_line *line;
|
|
||||||
int req, value;
|
|
||||||
|
|
||||||
chip = gpiod_chip_open("/dev/gpiochip0");
|
|
||||||
if (!chip)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
line = gpiod_chip_get_line(chip, 3);
|
|
||||||
if (!line) {
|
|
||||||
gpiod_chip_close(chip);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
req = gpiod_line_request_input(line, "gpio_state");
|
|
||||||
if (req) {
|
|
||||||
gpiod_chip_close(chip);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = gpiod_line_get_value(line);
|
|
||||||
|
|
||||||
printf("GPIO value is: %d\n", value);
|
|
||||||
|
|
||||||
gpiod_chip_close(chip);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user