Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Lopy4 TTN Join fail - Code examples NOT working #83

Open
@Synapsecontrols

Description

@Synapsecontrols

Hi,

We need an example code that works / with Lopy4 - The things Network for US frequency, we have several projects running with Pycom boards, there are too many flaws with these devices.

This code works with Lopy but NOT with Lopy4

from network import LoRa
import socket
import binascii
import time
import machine
import pycom
import os

pycom.heartbeat(False)

lora = LoRa(mode=LoRa.LORAWAN, public=True, adr=False)

for index in range(0, 8): #turn off channels 0-7
lora.remove_channel(index)

for index in range(16, 65): #turn off channels 16-64
lora.remove_channel(index)

for index in range(66, 72): #turn off channels 66-71
lora.remove_channel(index)

auth = (bytes([ 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x00, 0xB5, 0x78 ]),
bytes([ 0xCE, 0xF9, 0x6A, 0x8F, 0x9D, 0x28, 0x1D, 0x51, 0x4C, 0xEC, 0xF1, 0x14, 0xE3, 0xA9, 0xD3, 0x4C ]))

print("Starting Join...")
lora.join(activation=LoRa.OTAA, auth=auth, timeout=0)
x=0

while (not lora.has_joined() and x<10):
time.sleep(2.5)
print('Lora Joining...');
x=x+1
print('Lora has joined?= ', lora.has_joined())

s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setsockopt(socket.SOL_LORA, socket.SO_DR, 3)
lora.remove_channel(65)
s.setblocking(False)
time.sleep(5.0)

if (lora.has_joined()):
print('Joined...')

while True:
s.send(bytes([0x01]))
time.sleep(60)

I appreciate your help.

(sysname='LoPy', nodename='LoPy', release='1.18.1.r1', version='v1.8.6-849-b0520f1 on 2018-08-29', machine='LoPy with ESP32', lorawan='1.0.2')

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions