0

I want to plot graph of signal from RTL-SDR dongle but couldn't plot continuously at the same window without closing

Here's the code that i tried,

from pylab import *
from rtlsdr import *
from time import sleep    
sdr = RtlSdr()    
sdr.sample_rate = 2.4e6
p = sdr.start_freq = 95e6
sdr.gain = 50    

try:
    while True: # run until interrupted
        samples = sdr.read_samples(256*1024)
        psd(samples.real, NFFT=1024, Fs=sdr.sample_rate/1e6, Fc=p/1e6)
        xlabel('Frequency (MHz)')
        ylabel('Relative power (dB)')
        show()
        sleep(0.01) # sleep for 1s
except:
    pass

sdr.close()

can anyone help

ismail
  • 31
  • 8

0 Answers0