Created
September 17, 2013 16:06
-
-
Save n-west/6596522 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#!/usr/bin/env python | |
from gnuradio import gr, digital, blocks | |
from math import pi | |
def main( ): | |
fg = transmit_topblock(pi/8, sps=2) | |
fg.start() | |
while True: | |
debug_data = fg.debug.data() | |
if debug_data != (): | |
fg.debug.reset() | |
print debug_data | |
class transmit_topblock(gr.top_block): | |
def __init__(self, watermark_angle, sps): | |
gr.top_block.__init__(self) | |
self.source = blocks.udp_source(gr.sizeof_char, "127.0.0.1", 12002) | |
#self.modulator = digital.wbpsk_mod(angle=watermark_angle, samples_per_symbol=sps) | |
# put the usrp sink here | |
self.nullsink = blocks.null_sink(gr.sizeof_gr_complex) | |
# for debugging | |
self.debug = blocks.vector_sink_b( ) | |
# connect everything | |
#self.connect(self.source, self.modulator, self.nullsink) | |
self.connect(self.source, self.debug) | |
if __name__ == '__main__': | |
main( ) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import socket | |
UDP_IP = "127.0.0.1" | |
UDP_PORT = 12002 | |
MESSAGE = '\x23\x55\xaa' | |
print "UDP target IP:", UDP_IP | |
print "UDP target port:", UDP_PORT | |
print "message:", MESSAGE | |
sock = socket.socket(socket.AF_INET, # Internet | |
socket.SOCK_DGRAM) # UDP | |
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment