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; + }