How to set GPIO direction in beaglebone black in android using c code.....????

How to set GPIO direction in beaglebone black in android using c code…???

Hi,Friends,…

I’m Trying this code for set GPIO Direction For BBB in android ,compilation completed successfully But Output NO Change

Code:-

void input1(int pin)
{
char buf[10];
char buf2[50] = “/sys/class/gpio/gpio”;
FILE *in,*indir;

in = fopen("/sys/class/gpio/export", “w”);
fseek(in,0,SEEK_SET);
fprintf(in,"%d",47);
fflush(in);

sprintf(buf,"%i",pin);
strcat(buf2,strcat(buf,"/direction"));
indir = fopen(buf2, “w”);
fseek(indir,0,SEEK_SET);
fprintf(indir,“in”);
fflush(indir);
fclose(in);
fclose(indir);

}

Thank you…

  How to set GPIO direction in beaglebone black in android using c code…???

Hi,Friends,...

I'm Trying this code for set GPIO Direction For BBB in android ,compilation completed successfully But*Output NO
Change*......

What are you expecting to change? If this is a normal GPIO pin, the direction
will be already set to 'in' when you export it.

Thanks Thomas,

I’m expect starting this pin is output direction and than input direction…

actually use this code in dht11 sensor interfacing with BBB in using eclipse & NDK in C language …

Have you interrogated this pin? i.e. run the commands above in a shell?
On Android you should be able to do this with adb:
   $ adb shell
   (adb)% cd /sys/class/gpio
   (adb)% echo 47 >export
   (adb)% cd gpio47
   (adb)% cat direction
etc

Also, why do you think the pin will start out as an output?

Since your code does not check for any errors, you may simply be
getting ignored by the GPIO system in Linux.