Permalink
Browse files

a simple example

  • Loading branch information...
1 parent 3590d80 commit e6051fedf241bad4ebfe346fb5c6a21a282d371b @dbasden committed Apr 3, 2012
Showing with 36 additions and 0 deletions.
  1. +36 −0 example.py
View
@@ -0,0 +1,36 @@
+#! /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)
+
+ # This is actually a property that changes the frequency
+ s.frequency = 54000000
+ s.frequency = 927000000
+ s.frequency = 435012000
+ s.frequency = 145125000
+ s.frequency = 130100000
+ s.frequency = 105700000
+
+ s.reset_buffer() # Must do before first read
+ buf = s.read()
+ outf = open(sys.argv[1], "w")
+
+ try:
+ while True:
+ outf.write(s.read())
+ except KeyboardInterrupt:
+ pass
+ finally:
+ outf.close()
+ s.close()

0 comments on commit e6051fe

Please sign in to comment.