J
hello @catalin, I I have followed the procedures to download the latest firmware through Pybytes and I am using pymesh microphyton API, the problem I have is that with the following code the system chashes or not connect whit the other nodes, I do not know if it is a firmware problem or what it is due to, I will appreciate your help.
from network import LoRa
from mesh import LoraMesh
import ubinascii
import socket
import utime
from LoraWan import lorawan
import cayenneLPP
import config
import machine
from machine import SD
pycom.rgbled(0x0000ff) #blue
time.sleep(0.2)
pycom.rgbled(0x000000)
sd = SD()
os.mount(sd, '/sd')
f= open('/sd/reenvio.csv', 'a+')
r= open('/sd/reenvio.csv', 'r')
os.listdir('/sd')
while True:
print('##################### Conectando MESH ##################')
lora = LoRa(mode=LoRa.LORA, region=LoRa.US915, frequency = 904300000, bandwidth=LoRa.BW_125KHZ, sf=7)
masterkey = ubinascii.unhexlify("12345678")
pymesh = lora.Mesh(key=masterkey)
pymesh.border_router("2001:dead:beef:caff::/64", 0)
time.sleep(5)
print("IPv6 unicast addresses: %s"%pymesh.ipaddr())
print("4")
pycom.rgbled(0xff00) #GREEN
time.sleep(0.3)
pycom.rgbled(0x000000)
#IP=mesh.ipaddr()
#ipBR=str(IP[0])
#creando sockets:
s_EID = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s_EID.bind(config.puertoEID)
s_BR = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s_BR.bind(config.puertoBR)
s_mesh=[]
s_mesh.append(s_EID)
s_mesh.append(s_BR)
data= "hola"
id=0
ip=0
cont=0
#escuchando mesh
while cont<config.acumulador:
time.sleep(4)
paquete= Loramesh.receive_pack(s_mesh)
if paquete!=None:
data=paquete[0]
ip=paquete[1]
port=paquete[2]
print("-----------PAQUETE:%d-------"%cont)
print ('datos recividos: %s'% (data))
pycom.rgbled(0xff00) #verde
time.sleep(0.2)
pycom.rgbled(0xff00) #verde
time.sleep(0.2)
pycom.rgbled(0x000000)
time.sleep(2)
f.write('{},{},{}\n'.format(data,port,utime.localtime()))
cont+=1