Hi -

I have a USRP with 2 RFX2400 daughter cards and need to calibrate the local oscillator (LO) offset between them. To do this I want to modify the multi_scope.py example to allow me to reconfigure the flow graph without stopping. This is based on some external measurement I will do followed by a keypress and possibly an input using raw_input().

After studying the example Python code fragment taken from the "Controlling flow graphs" section of <http://gnuradio.org/trac/wiki/Tutorials/WritePythonApplications>http://gnuradio.org/trac/wiki/Tutorials/WritePythonApplications I was able to run the code below.

#!/usr/bin/env python

from gnuradio import gr
from gnuradio import audio
import time

class my_top_block(gr.top_block):

    def __init__(self):

        gr.top_block.__init__(self)

        sampling_freq = 48000
        ampl = 0.1

        self.src0 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, 350, ampl)
        self.src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, 440, ampl)

        self.adder = gr.add_ff()
        self.sink = audio.sink(sampling_freq)

        self.amp = gr.multiply_const_ff(1) # Define multiplier block

        self.connect(self.src0, (self.adder, 0))
        self.connect(self.src1, (self.adder, 1))

        self.connect(self.adder, self.amp, self.sink) # Connect all blocks

    def set_volume(self, volume):
        self.amp.set_k(volume)
        print "volume changed to", volume

if __name__ == '__main__':

    app = my_top_block()
    app.start()
    raw_input ('Press Enter to change volume: ')
    app.set_volume(2) # Pump up the volume (by factor 2)
    raw_input ('Press Enter to stop: ')
    app.stop()

#### end of simple code ###

I need help because the statements in the multi_scope.py script are more complicated. They are:

def main ():
    app = stdgui2.stdapp(my_top_block, "Multi Scope", nstatus=1)
    app.MainLoop()

if __name__ == '__main__':
    main ()

How can I run the scope app with a keypress and possibly an input using raw_input()?

Thank you in advance for your help.

 - Larry Wagner

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to