# Get\_gpio() help

**URL:** <https://www.ruby-forum.com/t/get-gpio-help/222402>\
**Category:** GNU Radio\
**Created:** [August 27, 2012, 2:02pm UTC](https://www.ruby-forum.com/t/get-gpio-help/222402 "2012-08-27T14:02:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 27, 2012, 2:02pm UTC](https://www.ruby-forum.com/t/get-gpio-help/222402/1 "2012-08-27T14:02:01Z")

</div>

Hello,

I am trying to work with the read\_gpio() function that is found in the  
dboard\_iface.cpp file. I am trying to read the io\_rx[15 - 0] pins on the  
basic\_rx daughterboard. I am able to read the pins using this function  
one  
time, but I am unable to continuously read the pins. Could anyone give  
any  
advise or help on how I could continuously read the pins? I was also  
wondering if there is a read\_gpio() function available in python? Thank  
you  
very much for your help and time.

## Sam

View this message in context:  
[http://old.nabble.com/get\_gpio()-help-tp34340767p34340767.html](http://old.nabble.com/get_gpio%28%29-help-tp34340767p34340767.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![sibar002](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@sibar002](https://www.ruby-forum.com/u/sibar002)\
**Post date:** [August 28, 2012, 7:06am UTC](https://www.ruby-forum.com/t/get-gpio-help/222402/2 "2012-08-28T07:06:16Z")

</div>

On Thu, Aug 23, 2012 at 5:54 PM, Samuel I. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,
> 
> Thank you for your help Frederick. The problem that I am having is that I  
> don’t really understand how I can get the read\_gpio() value into my python  
> code. Once I get the value to my python code, then I will be able to create  
> a loop that continuously reads the pins.

I’m not 100% sure, but I think all c++ files has to go through SWIG in  
order to be used in python. Have you tried to importing the class?

example: from uhd import dboard\_iface or imort dboard\_iface  
or something along those lines.

After importing you can probably run something like:

gpio\_value = read\_gpio( unit )

and that should give you your value. Perhaps someone that know this  
better  
can give a more complete answer.

Regards,

Frederick

---

<div class="post-metadata">

**Author:** ![sibar002](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@sibar002](https://www.ruby-forum.com/u/sibar002)\
**Post date:** [August 28, 2012, 7:06am UTC](https://www.ruby-forum.com/t/get-gpio-help/222402/3 "2012-08-28T07:06:17Z")

</div>

On 08/24/2012 09:00 AM, Frederick L. wrote:

> I’m not 100% sure, but I think all c++ files has to go through SWIG in  
> can give a more complete answer.

Thats the idea. You can call get\_dboard\_iface on the source or sink  
object:  
[http://gnuradio.org/cgit/gnuradio.git/tree/gr-uhd/include/gr\_uhd\_usrp\_sink.h#n474](http://gnuradio.org/cgit/gnuradio.git/tree/gr-uhd/include/gr_uhd_usrp_sink.h#n474)

This is available in python or c++ and all the same function calls  
should work.

-josh
