daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. import sys, os, string
  4.  
  5. from gnuradio import gr
  6. from gnuradio import audio
  7.  
  8. def build_graph ():
  9.     samplings_frek = raw_input("Samplingsfrekvens (Hz): ")
  10.     amplitud_1 = raw_input("Signalamplitud (V): ")
  11.     frek_1 = raw_input("Signalfrekvens (Hz): ")
  12.     amplitud_2 = raw_input("Barvagsamplitud (V): ")
  13.     frek_2 = raw_input("Barvagfrekvens (Hz): ")
  14.  
  15.     fg = gr.flow_graph ()
  16.     src0 = gr.sig_source_f (int(samplings_frek), gr.GR_SIN_WAVE, int(frek_1), float(amplitud_1))
  17.     src1 = gr.sig_source_f (int(samplings_frek), gr.GR_SIN_WAVE, int(frek_2), float(amplitud_2))
  18.     dst = audio.sink (int(samplings_frek))
  19.     multiplier = gr.multiply_ff ()
  20.     fg.connect ((src0, 0), (multiplier, 0))
  21.     fg.connect ((src1, 0), (multiplier, 1))
  22.     fg.connect (multiplier, (dst, 0))
  23.  
  24.     return fg
  25.  
  26. fg = build_graph ()
  27. fg.start ()
  28. raw_input ("Tryck Enter for att avsluta!")
  29. fg.stop ()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top