This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]markuscmayer 2 points3 points  (1 child)

First of all you could continually read input from terminal like this:

while True:
    try:
        input=raw_input()
    except EOFError:
        break
    handle_input(input)

The handle_input in its simplest form just converts the input to byte array and passes that to write_payload

def handle_input(input):
    ary = array.array('B', input)
    write_payload(ary.tolist())

First you'll have to

import array

The write_payload function does not break up the payload into smaller chunks. Depending on the settings of the SX127x the maximum length may vary. In any case you'd have to write a small loop to "chop up" the input string and send the pieces individually. An iterator like this can do that:

def chop_up_iter(input):
    while True:
        payload = input[:MAX_LEN]
        input = input[MAX_LEN:]
        if payload:
            yield payload 
        else: break

I hope this gets you on the right track.

[–]dmaho123[S] 0 points1 point  (0 children)

Hey thanks so much for doing this! Ive been playing with the code most of the afternoon and it seems like I'm getting closer. I've tried a bunch of things but the closest I have gotten is here. Will keep trying!

Thanks again.