E220-900T22S Python Library for Raspberry Pi.
Project description
RPi_E220-900T22S_LoRa_library
E220-900T22S Python Library for Raspberry Pi
Installation
pip install e220-900t22s
Example
# uart setup
sudo usermod -aG dialout <username>
sudo usermod -aG gpio <username>
sudo raspi-config
-> Interface Options
-> Serial Port
-> PC serial: no
-> Hardware serial: yes
-> ok
# reboot
from e220_900t22s.module import E220_900T22S
from e220_900t22s.register import Register
from e220_900t22s.enums import (SerialPortRateChoices, AirDataRateChoices,
SubPacketLengthChoices, TxPowerChoices,
TxMethodChoices, WORCycleChoices, Mode)
from RPi_GPIO_Helper import GPIO
# Port Initialize
dev = '/dev/ttyS0'
m0 = 23
m1 = 24
aux = 25
GPIO.cleanup(m0)
GPIO.cleanup(m1)
GPIO.cleanup(aux)
GPIO.setmode(GPIO.BCM)
# Register Setting
reg = Register(
address=0x0000,
serial_port_rate=SerialPortRateChoices.BPS9600,
air_data_rate=AirDataRateChoices.BPS1758_SF9_BW125KHZ,
sub_packet_length=SubPacketLengthChoices.BYTE200,
rssi_noise_enable=True,
tx_power=TxPowerChoices.DBM13,
channel=0,
rssi_byte_enable=True,
tx_method=TxMethodChoices.FIX,
wor_cycle=WORCycleChoices.MS2000,
crypt_key=0x0000,
)
module = E220_900T22S.create(reg, dev, m0, m1, aux)
module.configure()
module.change_mode(Mode.NORMAL)
# Sender
ret = module.send(0x0000, 0, bytes('Hello world'))
# Receiver
ret = module.read()
print(ret)
module.change_mode(Mode.SLEEP)
module.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
e220_900t22s-1.0.1.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for e220_900t22s-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 053f3c7b33f14391ab58779745da81f4c388620224bb932b91aa85deaf02619f |
|
MD5 | 5538bdebeb93add58872aaa4f3e72524 |
|
BLAKE2b-256 | b94df710766b644d8df6f31baf8448f4b09acd3f353ca856cfca71bc47bb7173 |