|
|
@ -7,13 +7,15 @@ from RNode import RNodeInterface |
|
|
|
# We'll also define which serial port the |
|
|
|
# We'll also define which serial port the |
|
|
|
# RNode is attached to. |
|
|
|
# RNode is attached to. |
|
|
|
serialPort = "/dev/ttyUSB0" |
|
|
|
serialPort = "/dev/ttyUSB0" |
|
|
|
|
|
|
|
# TODO: Remove |
|
|
|
|
|
|
|
serialPort = "/dev/tty.usbserial-DN03E0FQ" |
|
|
|
|
|
|
|
|
|
|
|
# This function gets called every time a |
|
|
|
# This function gets called every time a |
|
|
|
# packet is received |
|
|
|
# packet is received |
|
|
|
def gotPacket(data, rnode): |
|
|
|
def gotPacket(data, rnode): |
|
|
|
print "Received a packet: "+data |
|
|
|
print("Received a packet: "+data) |
|
|
|
print "RSSI: "+str(rnode.r_stat_rssi)+" dBm" |
|
|
|
print("RSSI: "+str(rnode.r_stat_rssi)+" dBm") |
|
|
|
print "SNR: "+str(rnode.r_stat_snr)+" dB" |
|
|
|
print("SNR: "+str(rnode.r_stat_snr)+" dB") |
|
|
|
|
|
|
|
|
|
|
|
# Create an RNode instance. This configures |
|
|
|
# Create an RNode instance. This configures |
|
|
|
# and powers up the radio. |
|
|
|
# and powers up the radio. |
|
|
@ -30,10 +32,10 @@ rnode = RNodeInterface( |
|
|
|
|
|
|
|
|
|
|
|
# Enter a loop waiting for user input. |
|
|
|
# Enter a loop waiting for user input. |
|
|
|
try: |
|
|
|
try: |
|
|
|
print "Waiting for packets, hit enter to send a packet, Ctrl-C to exit" |
|
|
|
print("Waiting for packets, hit enter to send a packet, Ctrl-C to exit") |
|
|
|
while True: |
|
|
|
while True: |
|
|
|
raw_input() |
|
|
|
input() |
|
|
|
rnode.send("Hello World!") |
|
|
|
rnode.send("Hello World!") |
|
|
|
except KeyboardInterrupt as e: |
|
|
|
except KeyboardInterrupt as e: |
|
|
|
print "" |
|
|
|
print("") |
|
|
|
exit() |
|
|
|
exit() |