You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since this is not an issue with the RFM9X library.
There probably should be an issue opened on the TinyLora library regards this. I'll open one there.
Since this is not an issue with the RFM9x library, I will close this and reference it in the TinyLora issue.
I brough one a few weeks ago and I cant get it to send data to the things network I have this code
import threading
import time
import subprocess
import busio
from digitalio import DigitalInOut,Direction,Pull
import board
import adafruit_ssd1306
from adafruit_tinylora.adafruit_tinylora import TTN,TinyLoRa
#Button A
btnA = DigitalInOut(board.D5)
btnA.direction = Direction.INPUT
btnA.pull = Pull.UP
#Button B
btnB = DigitalInOut(board.D6)
btnB.direction = Direction.INPUT
btnB.pull = Pull.UP
#Button C
btnC = DigitalInOut(board.D12)
btnC.direction = Direction.INPUT
btnC.pull = Pull.UP
#Create the I2C interface
i2c = busio.I2C(board.SCL,board.SDA)
#128x32 OLED Display
reset_pin = DigitalInOut(board.D4)
display = adafruit_ssd1306.SSD1306_I2C(128,32,i2c,reset=reset_pin)
#clear the display
display.fill(0)
display.show()
width = display.width
height = display.height
#TinyLora Configuration
spi = busio.SPI(board.SCK, MOSI=board.MOSI,MISO=board.MISO)
cs= DigitalInOut(board.CE1)
irq = DigitalInOut(board.D22)
rst = DigitalInOut(board.D25)
#TTN Device Address,4 Bytes MSB
devaddr = bytearray([0x00, 0x00, 0x00, 0x00])
#TTN Network Key 16 bytes,MSB
nwkey = bytearray([0x3C, 0xD4, 0x7D, 0xEF, 0x75, 0xF1, 0xFA, 0x28, 0xD8, 0x84, 0xDA, 0x5D, 0xB6, 0xF8, 0x9D, 0x0D])
#TTN Application Key,16 Bytes,MSB
app = bytearray([0x99, 0xEC, 0x31, 0x76, 0x43, 0xC7, 0x9E, 0xE1, 0xFB, 0x08, 0x61, 0xD3, 0x72, 0xD4, 0xE3, 0xB3])
#Initialize ThingsNetwork configuration
ttn_config = TTN(devaddr,nwkey,app, country='AUS')
#Initialize lora object
lora = TinyLoRa(spi, cs ,irq, rst, ttn_config)
#2b array to store sensor data
data_pkt = bytearray(2)
#time to delay periodic packet sends (in second)
data_pkt_delay = 5.0
def send_pi_data_periodic():
threading.Timer(data_pkt_delay,send_pi_data_periodic).start()
print("Sending periodic data...")
send_pi_data(CPU)
print('CPU:',CPU)
def send_pi_data(data):
#Encode float as int
data = int(data * 100)
#Encode payload as bytes
data_pkt[0] = (data >> 8) & 0xff
data_pkt[1] = data & 0xff
#send data packet
lora.send_data(data_pkt,len(data_pkt),lora.frame_counter)
lora.frame_counter += 1
display.fill(0)
display.text('send Data to TTN!',15,15,1)
print('Data sent!')
display.show()
time.sleep(0.5)
while True:
packet = None
#draw a bow to clear the image
display.fill(0)
display.text('RASPI LORAWAN',35,0,1)
The code doen't work on the things network v3 does anyone know how to fix this
The text was updated successfully, but these errors were encountered: