コード例 #1
0
def get_data_from_sensor(sensor_id="RAND"):
    if sensor_id == "RAND":
        return ufun.random_in_range()
コード例 #2
0
ファイル: server.py プロジェクト: gie-sakura/msnlora
sd = SD()
os.mount(sd, '/sd')
print("SD Card Enabled")
#Starting LoRa
lora = LoRa(mode=LoRa.LORA,
        frequency=freq,         
        tx_power=tx_pow,               
        bandwidth=band,    
        sf=spreadf,                       
        preamble=prea,               
        coding_rate=cod_rate,
        power_mode=pow_mode,  
        tx_iq=tx_iq_inv,                
        rx_iq=rx_iq_inv,                
        adr=ada_dr,                  
        public=pub,       
        tx_retries=tx_retr,              
        device_class=dev_class)
# AM: Se configura la lopy como punto de Acceso y servidor HTTP
# PM: choosing random name for lopy
lopy_name = "messenger"+str(ufun.random_in_range())
wlan = WLAN(mode=WLAN.STA_AP, ssid=lopy_name)
wlan.init(mode=WLAN.STA_AP, ssid=lopy_name, auth=None, channel=7, antenna=WLAN.INT_ANT)
print("Red Name: "+str(lopy_name))
print ("Starting web server")
tabla=BaseDatos() #Instanciamiento Clase Base de Datos
s = Server(80)  # construct server object
my_lora_address = binascii.hexlify(network.LoRa().mac())
s.activate_server() # Acquire the socket
s.connectionLoRa() #Acquire Socket LoRa
s.conexion()