On 03/16/2016 06:18 AM, Sumit Bhut wrote:
> 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.
>
> *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.....
> *
--
Gary Thomas