Code with direction function

arguments
Angelus Vela 23 hours ago
parent f488857879
commit 0f9f410d49

@ -72,3 +72,17 @@ int gpio_export(const char *gpio){
close(fd); close(fd);
return 0; 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;
}

Loading…
Cancel
Save