On 03/17/2016 05:44 AM, Sumit Bhut wrote:


On Wednesday, March 16, 2016 at 10:56:42 AM UTC+5:30, Gary Thomas wrote:

    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




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.

--
Gary Thomas

--
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