Community
cancel
Showing results for 
Search instead for 
Did you mean: 
sch1
Novice
2,390 Views

running python script to access the gpio pins

Hi,

 

i want to work with GPIO of galileo using C++ from yocto linux image.i have been following the below link to understand things:

http://wiki.ros.org/IntelGalileo/IntelGalileoGPIO http://wiki.ros.org/IntelGalileo/IntelGalileoGPIO

here the first step is to edit this file etc/udev/rules.d/99-gpio.rules

but i don't have the 'udev' folder inside the 'etc' folder. Kindly guide me whats missing here and how can i fix it.

Also for the following two commands,

sudo groupadd -f --system gpio

sudo udevadm control --reload-rules

I get an error 'sudo command not found'.

I am logged in through telnet and the 'whoami' command showsme as root. I am working on Galileo G2 board.

My goal is to convert this code into cpp code once its working.

Regards

Saher

Tags (1)
0 Kudos
13 Replies
Juan_M_Intel
Employee
252 Views

Hi SAHER_MAQSOOD,

If you want to know if a certain package is currerntly installed in your Yocto image, I'd suggest you to use the following command opkg list-installed. About the error you got by running the two commands, that is due that Yocto does not have sudo, in fact this is not necessary since you are logged as root. Try typing the same commands without sudo. I hope you find this helpful.

 

Regards,

 

JPMontero_Intel
RBrad2
Valued Contributor I
252 Views

Hi Saher Maqsood

I am a bit confused as to what you are trying to do. You title was about using Python but the text was about C++

You also said you telnet in, which makes me think you are not running any of the images from an SD card so you could use SSH.

 

In any case, the reason you don't have "sudo" is you are logged in as root so don't need to become super user to run a command.

If you want to use Python, do a search and you can find several ways to access GPIO. If you want to run C++ you need to use a distribution that includes development tools

rgb

sch1
Novice
252 Views

Hi rgb, JPMontero_Intel,

 

 

The code that i have referred to in the message is in python. I thought i would run it first and if it works,i can change it to C++.

I am running the SD card image but had some problem logging in through SSH so i am working with telnet.I hope that is not a problem here.

 

I have looked at various methods to access gpio via python but haven't found much stuff on C++. Most of the links have this same command that I have mentioned above to allow users to manipulate gpio (as I understand).

 

/etc/udev/rules.d/99-gpio.rules

I need to go in the folder 'udev' which does not exist in my case.

Can you tell me what this folder is usually about and which package should I install for it?

Also I don't understand much when you say 'If you want to run C++ you need to use a distribution that includes development tools'. Can you explain it a bit please?

Regards

 

Saher Maqsood
Matthias_H_Intel
Employee
252 Views

In any case, the reason you don't have "sudo" is you are logged in as root so don't need to become super user to run a command.

I'd rather assume the reason is: no sudo binary is installed.

Still being root you won't require sudo for running programs as root

RBrad2
Valued Contributor I
252 Views

Hi Mhanh

Yes your answer is more correct, sudo isn't installed as it is expected people will work in root.

rgb

RBrad2
Valued Contributor I
252 Views

At least that is my guess :-)

RBrad2
Valued Contributor I
252 Views

Hi Saher

The standard version of Yocto put out by Intel doesn't include the programs you need to compile C programs - so you need to use one that does.

 

AlexT put up a version http://alextgalileo.altervista.org/blog/updated-galileo-devtools-image/ Updated Galileo "devtools" image is out that has the tools and the IoT version also has them. You might want to look at their site as they have a number of tutorial

https://software.intel.com/en-us/getting-started-for-c-c-plus-plus-eclipse-galileo-and-edison https://software.intel.com/en-us/getting-started-for-c-c-plus-plus-eclipse-galileo-and-edison

https://software.intel.com/en-us/next-steps-create-applications-with-devkit Next Steps: Create Applications with Intel® IoT Dev Kit

IoT is mostly focused on using Node.js, but they have a number of examples in C++

.https://github.com/intel-iot-devkit/mraa/tree/master/examples/c%2B%2B mraa/examples/c++ at master · intel-iot-devkit/mraa · GitHub

A lot of people also use C++ with the standard version by Alex, and you can do a search to find references by using the search tool in the upper right hand corner of the screen.

I usually work with Python, and use the library from EmuTex's wiring_x86 library http://www.emutexlabs.com/project/209-introduction-to-wiring-x86-for-intel-edison-and-galileo-gen2 http://www.emutexlabs.com/project/209-introduction-to-wiring-x86-for-intel-edison-and-galileo-gen2

As for the reference to the tutorial to the Robot Operating System site, I looked at it before and couldn't figure out how to install their software on the Galileo, which I assume is needed before you can follow their tutorials.

Hope the above helps

rgb

Matthias_H_Intel
Employee
252 Views

SAHER_MAQSOOD wrote:

Hi,

 

i want to work with GPIO of galileo using C++ from yocto linux image.i have been following the below link to understand things:

http://wiki.ros.org/IntelGalileo/IntelGalileoGPIO http://wiki.ros.org/IntelGalileo/IntelGalileoGPIO

here the first step is to edit this file etc/udev/rules.d/99-gpio.rules

but i don't have the 'udev' folder inside the 'etc' folder. Kindly guide me whats missing here and how can i fix it.

Also for the following two commands,

sudo groupadd -f --system gpio

sudo udevadm control --reload-rules

I get an error 'sudo command not found'.

I am logged in through telnet and the 'whoami' command showsme as root. I am working on Galileo G2 board.

My goal is to convert this code into cpp code once its working.

Regards

Saher

not sure which SD card image you use. In case it's the Intel(R) IoT developper kit eglibc based version (https://software.intel.com/de-de/iot/downloads https://software.intel.com/de-de/iot/downloads) you can use mraa (https://github.com/intel-iot-devkit/mraa intel-iot-devkit/mraa · GitHub) in order to access IO

Carlos_M_Intel
Employee
252 Views

Hi SAHER_MAQSOOD

Do you have updates in this? Did the last suggestions work for you?

Regards;

CMata

sch1
Novice
252 Views

Hi CMata_Intel,

Yes, its figured out now.

The ROS software for galileo was not installed properly and that is why I was not able to find the 'udev' folder. The root user issue was also clarified. Thanks.

NPaol1
Novice
252 Views

Hi SAHER_MAQSOOD

I am having the same trouble i just cant edit the /etc/udev/rules.d/99-gpio.rules file.

Because it doesnt exist all that exists in my udev directory is this:

root@galileo:/etc/udev/rules.d# ls

60-sysprof.rules 99-fuse.rules touchscreen.rules

How was the ROS software not installed properly?

how does it installs properly?

i am using the IoT devkit image ,  

and i have got some other troubles like not installing NANO properly.

 

Best Regards thank you!

NPaol1
Novice
252 Views

CMata_Intel

Please do you know how to add ROS features properly to the Yocto Image?

Best regards

Nicholas_Inatel

Carlos_M_Intel
Employee
252 Views

Hi Nicholas_Inatel @Nicholas_Inatel;

I found this http://wiki.ros.org/IntelGalileo/HydroGalileoInitialInstall IntelGalileo/HydroGalileoInitialInstall - ROS Wikil about how to install the features you want. Take a look at it.

Regards;

CMata

Reply