GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — RTNode-HeltecV4/Python Module/Example.py at main · jrl290/RTNode-HeltecV4 Expand file tree/ Copy pathExample.pyMore file actions executable file ·47 lines (42 loc) · 1.17 KB / Copy pathExample.pyFile metadata and controlsexecutable file ·47 lines (42 loc) · 1.17 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 # This is a short example program that # demonstrates the bare minimum of using # RNode in a Python program. # # The example and the RNode.py library is # written for Python 3, so be sure to run # it with: python3 Example.py # First we'll import the RNodeInterface class. from RNode import RNodeInterface # We'll also define which serial port the # RNode is attached to. serialPort = "/dev/ttyUSB0" # This function gets called every time a # packet is received def gotPacket(data, rnode): message = data.decode("utf-8") print("Received a packet: "+message) print("RSSI: "+str(rnode.r_stat_rssi)+" dBm") print("SNR: "+str(rnode.r_stat_snr)+" dB") # Create an RNode instance. This configures # and powers up the radio. rnode = RNodeInterface( callback = gotPacket, name = "My RNode", port = serialPort, frequency = 868000000, bandwidth = 125000, txpower = 2, sf = 7, cr = 5, loglevel = RNodeInterface.LOG_DEBUG) # Enter a loop waiting for user input. try: print("Waiting for packets, hit enter to send a packet, Ctrl-C to exit") while True: input() message = "Hello World!" data = message.encode("utf-8") rnode.send(data) except KeyboardInterrupt as e: print("") exit() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |