I'm trying to manipulate my GPIOs using C code and running into "Permission 
Denied" when running my code and opening the file /sys/class/gpio/export. 
I'm using nano editor, compiling on the Beaglebone with gcc, and I'm under 
root user.

I would like to do this, so I can set directions and values for the GPIOs 
with my code. I've heard this might be a problem with user and kernel space 
conflicting. I know there are library calls in python and other languages 
to do this that work. Does anyone know what this problem might be and our 
their alternate calls I can do in C?

I tried to just include the necessary parts of the code.
Code:
#include<fcntl.h>
static const char *GPIO_PATH = "/sys/class/gpio/export";
int main(){
     int file;
     if ((file = open(GPIO_PATH, O_RDWR))<0){
           perror("GPIO: Can't open the device.");
           return -1;
     }
     return 0;
}

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to