-
Hi all,
i am trynig to have a comm between 2 lopys using the LoRa.LORA mode.
I used this code :server:
from network import LoRa import socket lora = LoRa(mode=LoRa.LORA) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) mydata = s.recv(64) print(mydata)client:
from network import LoRa import socket lora = LoRa(mode=LoRa.LORA) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.send(b'0123456789')nothing happens...
I dont see anything transiting.
What am i doing wrong ?Thx
François -
Hi
I think its because you only listen once. you need to get the server constantly listening.
While (true):
mydata = s.recv(64)
print(mydata)Then send the packet again.
Also not all packets make it to the server so posibly loop the "send as" as well with a:
time.sleep(2)
at the end of the loop.
James
-
Thx for your answer.
So i did that :Client :
from network import LoRa import socket import time lora = LoRa(mode=LoRa.LORA) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setblocking(False) while(True): s.send(b'0123456789') time.sleep(2)Server :
from network import LoRa import socket lora = LoRa(mode=LoRa.LORA) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setblocking(False) while(True): mydata = s.recv(64) if (len(mydata)>2): print(mydata)Stil nothing is printed.
And my REPL is out because it seems overloaded. Is it normal ?François
-
My configuration :
import os; [os.uname().sysname, os.uname().machine, os.uname().release] ['LoPy', 'LoPy with ESP32', '0.9.5.b1'] -
Hello @fb
here is a nice example on how t ouse 2 LoPys to connect them using LoRa.
https://forum.pycom.io/topic/236/lopy-nano-gatewayHope this helps
Best,
Roberto -
Thanks !
I tried this but doesnt work for me !
Thats why i did something simpler. -
Thanks to Roberto, problem is solved.
Seems to be a pbm my boot.pyBad one :
import os from machine import UART uart = UART(0, 115200) os.dupterm(uart)Good one :
import machine import os import time uart = machine.UART(0, 115200) os.dupterm(uart)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login