Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access GPIO pins #205

Open
rajmehta28599 opened this issue Jun 4, 2021 · 2 comments
Open

Unable to access GPIO pins #205

rajmehta28599 opened this issue Jun 4, 2021 · 2 comments

Comments

@rajmehta28599
Copy link

rajmehta28599 commented Jun 4, 2021

I have a BeagleBone Black board and I'm using the below-mentioned image file.
https://debian.beagleboard.org/images/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz

###################################
I aim to operate GPIO pins of this board with the c programming language.

To do so, I've gone through this link: https://beagleboard.org/static/librobotcontrol/installation.html

And after following all the steps according to this link the result I achieved is the same as mentioned in the checking functionality step [the last step] of this document.

################################
Furthermore, I follow this document for c language setup:
https://github.com/beagleboard/librobotcontrol/blob/master/docs/src/project_template.dox

and run this source code:
https://beagleboard.org/static/librobotcontrol/rc_test_leds_8c-example.html

All these processes were completed without any error.

##################################
Now I want to access the GPIO pins of the board. For that, I've prepared a basic code.

Let's take a pin P8_10 / GPIO2[4] for an example. So for that my code will be:

#include <stdio.h>
#include <rc/led.h>
#include <rc/gpio.h>
#include <rc/time.h>
//#define WAIT_US 500000 // time to light each LED in microseconds
int main()
{
rc_gpio_init(2,4,GPIOHANDLE_REQUEST_OUTPUT); /* declare as output*/
rc_gpio_set_value(2,4,1); /* set high */
rc_gpio_cleanup(2,4);
    return 0;
}

After executing this code I am not getting the expected output.

So have you any suggestions for me regarding this code.
Or is there any other way to do so?

Thank you.

@StjerneIdioten
Copy link

If I am not mistaken rc_gpio_cleanup(2,4); will cleanup everything, so if you expect to have some input to measure after running that code, then it won't work. It is only set for as long as your program is running. Which in your case is a very short time.

@Pryscilla123
Copy link

I'm having the same issue, i did a code basically identical as the other one, but i didnt use the clean, just the set and my program is accusing of pin X not initialized yet. What should i do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants