# Small example - using UHD function

**URL:** <https://www.ruby-forum.com/t/small-example-using-uhd-function/232276>\
**Category:** GNU Radio\
**Created:** [September 29, 2014, 4:42pm UTC](https://www.ruby-forum.com/t/small-example-using-uhd-function/232276 "2014-09-29T16:42:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 29, 2014, 4:42pm UTC](https://www.ruby-forum.com/t/small-example-using-uhd-function/232276/1 "2014-09-29T16:42:03Z")

</div>

Hello everyone,  
It’s a bit of time that I try to use the functions of class UHD, but  
unfortunately without success.

I have prepared a small example in which you can reproduce the error  
obtained when launching the simulation.

Since it makes use of gr-802.11 you need to install this library,  
and also install the block that I created, folder gr-test\_simone  
attached  
here, the name of the code is using\_uhd.  
In short, this block should work as an AGC, in particular it reads the  
gain  
from the USRP, processes, and writes the new value.  
I would be very grateful if someone with a little patience can correct  
me  
where I’m wrong!

-\> Settings for using\_uhd block,  
alpha = damping constant = 0.001  
reference = allowed\_ADC\_range^2 = 0,025 half dynamic (full dynamic is  
1)

obtained error:

* * *

Traceback (most recent call last):  
File “/home/simone/Scrivania/top\_block.py”, line 238, in   
tb = top\_block(address=options.address)  
File “/home/simone/Scrivania/top\_block.py”, line 76, in **init**  
self.test\_simone\_using\_uhd\_0 = test\_simone.using\_uhd(0.001, 0.025)  
AttributeError: ‘module’ object has no attribute ‘using\_uhd’

* * *

I think that the problem is how I use address in using\_uhd\_impl.cc when  
I  
call the “sptr = make”!

Cordially,  
Simone Ciccia

---

<div class="post-metadata">

**Author:** ![Simone\_Ciccia\_S2106](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Simone\_Ciccia\_S2106](https://www.ruby-forum.com/u/Simone_Ciccia_S2106)\
**Post date:** [September 29, 2014, 7:09pm UTC](https://www.ruby-forum.com/t/small-example-using-uhd-function/232276/2 "2014-09-29T19:09:05Z")

</div>

Simone,

you’re asking a bit much of people who are essentially volunteers if  
they need to install several modules before they can run and test your  
code for you.

Obviously, SWIG isn’t picking up the class you wrote. There can be  
several reasons for this, maybe you forgot it in your SWIG files (are  
you using gr\_modtool?) or your block definition is incorrect…

I suggest you start with something simpler first, until you’ve learned  
the intricacies of building OOTs. We have the new ‘guided tutorials’ on  
the website to help you with this.

M
