# see the Pycom Licence v1.0 document supplied with this file, or # available at https://www.pycom.io/opensource/licensing # """ LoPy LoRaWAN Nano Gateway example usage """ import config import time from nanogateway import NanoGateway from machine import WDT if __name__ == '__main__': nanogw = NanoGateway(id=config.GATEWAY_ID, frequency=config.LORA_FREQUENCY, datarate=config.LORA_GW_DR, ssid=config.WIFI_SSID, password=config.WIFI_PASS, server=config.SERVER, port=config.PORT, ntp_server=config.NTP, ntp_period=config.NTP_PERIOD_S) nanogw.start() nanogw._log('You may now press ENTER to enter the REPL') wdt = WDT(timeout=15000) while True: #print("feeding wdt") wdt.feed() time.sleep(5) #input()
"""LoPy LoRaWAN Nano Gateway""" from nanogateway import NanoGateway import config gateway = NanoGateway(id=config.GATEWAY_ID, frequency=config.LORA_FREQUENCY, datarate=config.LORA_DR, ssid=config.WIFI_SSID, password=config.WIFI_PASS, server=config.SERVER, port=config.PORT, ntp=config.NTP, ntp_period=config.NTP_PERIOD_S) gateway.start()
from nanogateway import NanoGateway if __name__ == '__main__': # Gateway configuration. Change as you need. GW = NanoGateway(wifi_ssid='My Awesome Network', wifi_password='******') GW.start() GW.log('You may now press ENTER to open a REPL.') input()
""" LoPy LoRaWAN Nano Gateway example usage """ import config from nanogateway import NanoGateway nanogw = NanoGateway(id=config.GATEWAY_ID, frequency=config.LORA_FREQUENCY, datarate=config.LORA_DR, ssid=config.WIFI_SSID, password=config.WIFI_PASS, server=config.SERVER, port=config.PORT, ntp=config.NTP, ntp_period=config.NTP_PERIOD_S) nanogw.start()
""" LoPy LoRaWAN Nano Gateway example usage """ import config from nanogateway import NanoGateway nanogw = NanoGateway(id=config.GATEWAY_ID, frequency=config.LORA_FREQUENCY, datarate=config.LORA_DR, server=config.SERVER, port=config.PORT) nanogw.start()
Bibliotecas importadas: config (Arquivo criado com as configurações a serem utilizadas - config.py) nanogateway */ # Importando bibliotecas import config from nanogateway import NanoGateway # Criando uma instância do NanoGateway e configurando com os parâmetros definidos no config.py if __name__ == '__main__': nanogw = NanoGateway( id=config.GATEWAY_ID, # ID do Gateway que será autenticado na TTN frequency=config.LORA_FREQUENCY, # Frequência a ser utilizada na transmissão LoRa datarate=config.LORA_GW_DR, # Datarate utilizado ssid=config.WIFI_SSID, # SSID da rede Wi-Fi que o LoPy4 se conectará para transmistir para a internet password=config.WIFI_PASS, # Senha da rede Wi-Fi server=config.SERVER, # Servidor utilizado da TTN port=config.PORT, # Porta de acesso ao servidor da TTN ntp_server=config.NTP, # Servidor NTP utilizado ntp_period=config.NTP_PERIOD_S # Período, em segundos, entre as sincronizações com o NTP ) # inicialização da instância do NanoGateway nanogw.start() # Se estiver conectado via terminal ao LoPy4, pressione Enter para utilizar o REPL nanogw._log('Pressione Enter para utilizar o REPL') input()