def sat_transmit(data): # data : string of data to be sent via satellite ser = serial.Serial("/dev/ttyUSB0", 19200) rb = RockBlock(ser) #bindata = struct.pack("i", len(data)) # converts the data to binary rb.text_out = data # put data in outbound buffer print("Talking to satellite...") status = rb.satellite_transfer() # loop as needed retry = 0 while status[ 0] > 8 and retry < 8: # Keeps trying until data is sent. Max retries = 5 time.sleep(10) status = rb.satellite_transfer() print(retry, status) retry += 1 if status[0] > 8: print("Transmission failed") print("\nDONE.")
# CircuitPython / Blinka import board uart = board.UART() uart.baudrate = 19200 # via USB cable # import serial # uart = serial.Serial("/dev/ttyUSB0", 19200) from adafruit_rockblock import RockBlock rb = RockBlock(uart) # set the text rb.text_out = "hello world" # try a satellite Short Burst Data transfer print("Talking to satellite...") status = rb.satellite_transfer() # loop as needed retry = 0 while status[0] > 8: time.sleep(10) status = rb.satellite_transfer() print(retry, status) retry += 1 print("\nDONE.")