def __init__(self, verbose=False): BOARD.setup() BOARD.reset() super(Transceiver, self).__init__(verbose) self.set_mode(MODE.SLEEP) self.config("long") self.setmode("RX") self.receiving = [] self.transmitting = [] self.txn = 0 self.rxn = None assert(self.get_agc_auto_on() == 1)
#!/usr/bin/env python3 import time from SX127x.LoRa import * from SX127x.board_config import BOARD BOARD.setup() BOARD.reset() class mylora(LoRa): def __init__(self, verbose=False): super(mylora, self).__init__(verbose) self.set_mode(MODE.SLEEP) self.set_dio_mapping([0] * 6) self.var = 0 def on_rx_done(self): BOARD.led_on() # Set rx flag to 1 self.clear_irq_flags(RxDone=1) # Get payload and decode payload = self.read_payload(nocheck=True) payload_conv = bytes(payload).decode("utf-8", 'ignore') # Prints payload print("RX: " + payload_conv) # Extract node number, t, and h from sender
import os import threading import time import cola from subirDatosServidor import * from SX127x.LoRa import * from SX127x.board_config import BOARD from data_frame import * import pickle from angles import sexa2deci """Es necesario instalar la libreria angles "pip install angles""" BOARD.setup() #Mapeo de pines de la raspberry BOARD.reset() #Reseteo de los pines nodos = 1 # Cantidad de Nodos Clientes(maximo 255) t_sample = 1 #Decenas de segundos(maximo 255) class mylora(LoRa): def __init__(self, verbose=False): super(mylora, self).__init__(verbose) self.set_mode(MODE.SLEEP) self.set_dio_mapping([0] * 6) self.Recibido = False # Flag de paquete recibido self.TimeOut = False # Flag para detectar Timeout self.paqueteACK = bytes( [0]) # paquete ACK utilizado para indicar la llegada de un mensaje self.paqueteRecibidoC = bytes(0) #Callbacks def on_rx_done(self):