update for breaking tinylora changes!
This commit is contained in:
parent
4572859f27
commit
946757461a
3 changed files with 12 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
"""TinyLoRa with a Si7021 Sensor.
|
||||
"""Using TinyLoRa with a Si7021 Sensor.
|
||||
"""
|
||||
import time
|
||||
import busio
|
||||
|
|
@ -16,15 +16,17 @@ i2c = busio.I2C(board.SCL, board.SDA)
|
|||
sensor = adafruit_si7021.SI7021(i2c)
|
||||
|
||||
# Create library object using our bus SPI port for radio
|
||||
spi = busio.SPI(board.SCK, MISO=board.MISO, MOSI=board.MOSI)
|
||||
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
||||
|
||||
# RFM9x Breakout Pinouts
|
||||
cs = digitalio.DigitalInOut(board.D5)
|
||||
irq = digitalio.DigitalInOut(board.D6)
|
||||
rst = digitalio.DigitalInOut(board.D4)
|
||||
|
||||
# Feather M0 RFM9x Pinouts
|
||||
# irq = digitalio.DigitalInOut(board.RFM9X_D0)
|
||||
# cs = digitalio.DigitalInOut(board.RFM9X_CS)
|
||||
# irq = digitalio.DigitalInOut(board.RFM9X_D0)
|
||||
# rst = digitalio.DigitalInOut(board.RFM9X_RST)
|
||||
|
||||
# TTN Device Address, 4 Bytes, MSB
|
||||
devaddr = bytearray([0x00, 0x00, 0x00, 0x00])
|
||||
|
|
@ -39,7 +41,7 @@ app = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|||
|
||||
ttn_config = TTN(devaddr, nwkey, app, country='US')
|
||||
|
||||
lora = TinyLoRa(spi, cs, irq, ttn_config)
|
||||
lora = TinyLoRa(spi, cs, irq, rst, ttn_config)
|
||||
|
||||
# Data Packet to send to TTN
|
||||
data = bytearray(4)
|
||||
|
|
@ -67,4 +69,4 @@ while True:
|
|||
led.value = True
|
||||
lora.frame_counter += 1
|
||||
time.sleep(2)
|
||||
led.value = False
|
||||
led.value = False
|
||||
|
|
@ -16,6 +16,7 @@ spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
|||
# pylint: disable=c-extension-no-member
|
||||
cs = DigitalInOut(board.RFM9X_CS)
|
||||
irq = DigitalInOut(board.RFM9X_D0)
|
||||
rst = DigitalInOut(board.RFM9X_RST)
|
||||
|
||||
# TTN Device Address, 4 Bytes, MSB
|
||||
devaddr = bytearray([0x00, 0x00, 0x00, 0x00])
|
||||
|
|
@ -30,7 +31,7 @@ app = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|||
|
||||
ttn_config = TTN(devaddr, nwkey, app, country='US')
|
||||
|
||||
lora = TinyLoRa(spi, cs, irq, ttn_config, channel = 6)
|
||||
lora = TinyLoRa(spi, cs, irq, rst, ttn_config, channel = 6)
|
||||
|
||||
# bme data packet
|
||||
bme_d = bytearray(7)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ height = display.height
|
|||
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
|
||||
|
|
@ -56,7 +58,7 @@ app = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|||
# Initialize ThingsNetwork configuration
|
||||
ttn_config = TTN(devaddr, nwkey, app, country='US')
|
||||
# Initialize lora object
|
||||
lora = TinyLoRa(spi, cs, irq, ttn_config)
|
||||
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 seconds)
|
||||
|
|
|
|||
Loading…
Reference in a new issue