Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from gnuradio import gr
- from gnuradio import uhd
- from time import sleep, time
- from grc_gnuradio import blks2 as grc_blks2
- class top_block(gr.top_block):
- def __init__(self):
- gr.top_block.__init__(self, "Top Block")
- # self.uhd = uhd.usrp_source(
- # device_addr="",
- # io_type=uhd.io_type.COMPLEX_FLOAT32,
- # num_channels=1,
- #)
- #self.uhd.set_samp_rate(8000000)
- #self.uhd.set_center_freq(860000000, 0)
- #self.uhd.set_gain(10, 0)
- #
- self.sink_queue = gr.msg_queue(10240)
- self.msg_sink = gr.message_sink(gr.sizeof_float, self.sink_queue, False)
- self.sig = gr.sig_source_f(8000000, gr.GR_SIN_WAVE, 350, .5, 0)
- self.null_sink = gr.null_sink(gr.sizeof_float)
- self.valve = grc_blks2.valve(gr.sizeof_float, bool(1))
- self.null_sink2 = gr.null_sink(gr.sizeof_float)
- self.valve2 = grc_blks2.valve(gr.sizeof_float, bool(1))
- self.connect(self.sig, self.msg_sink)
- self.connect(self.sig, self.valve, self.null_sink)
- self.connect(self.sig, self.valve2, self.null_sink2)
- #self.connect(self.sig, self.msg_sink)
- if __name__ == '__main__':
- tb = top_block()
- tb.start()
- sleep(1)
- while(1):
- while(tb.sink_queue.count()>0):
- tb.sink_queue.flush()
- #tb.lock()
- #tb.unlock()
- tb.valve.set_open(bool(0))
- tb.valve.set_open(bool(1))
- sleep(0.001)
- print 'noflow'
- sleep(0.5)
- tb.stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement