Permalink
Browse files

a simple sweep example

  • Loading branch information...
1 parent e6051fe commit 46e56f145b3e86002cacd7f4fafe8723419593ea @dbasden committed Apr 3, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 sweep.py
View
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+
+from rtlsdr import RtlSDR
+import sys
+
+if __name__ == "__main__":
+
+ if len(sys.argv) < 2:
+ print >> sys.stderr, sys.argv[0], "<outfile>"
+ sys.exit(1)
+
+ if RtlSDR.get_device_count() < 1:
+ raise IOError("No known devices found")
+
+ s = RtlSDR(0, 105700000, 1024000)
+
+ outf = open(sys.argv[1], "w")
+ #s.reset_buffer() # Must do before first read
+
+ try:
+ for n in range(500,10000,5):
+ n = n *.1
+ print >> sys.stderr, n,"MHz",
+ s.frequency = int(n * 10**6)
+ s.reset_buffer()
+ for c in xrange(3):
+ outf.write(s.read())
+ except KeyboardInterrupt:
+ pass
+ finally:
+ outf.close()
+ s.close()

0 comments on commit 46e56f1

Please sign in to comment.