From 0f9f410d4907f1c3f7cc212ebb0146cda5524b86 Mon Sep 17 00:00:00 2001 From: Angelus Vela Date: Thu, 24 Sep 2026 11:00:33 -0600 Subject: [PATCH] Code with direction function --- main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.c b/main.c index 86c9261..65f8eef 100644 --- a/main.c +++ b/main.c @@ -72,3 +72,17 @@ int gpio_export(const char *gpio){ close(fd); return 0; } + +//Gpio direction +int gpio_direction(int gpio, const char *direction){ + int fd; + //export + fd = open("/sys/class/gpio/chip0/export", O_WRONLY); + if(fd<0){ + perror("Error openng the GPIO path"); + return -1; + } + write(fd,gpio, strlen(gpio)); + close(fd); + return 0; + }