lt22222l
#!/bin/sh
# This scripts shows how to use LPS8/LG308/DLOS8 to communicate with two LoRaWAN End Nodes, without the use of internet or LoRaWAN server
#
# Hardware Prepare:
# 1. LT-22222-L x 2, both are configured to work in
# a) Class C ;
# b) ABP Mode ;
# c) AT+Mod=1
# 2. LPS8,
# a) Firmware version >
# b) Input the LT-22222-L keys in LPS so LPS8 can talk with them.
# c) Lorawan server choose built-in
# d) in Custom page, select custom script to point to this script. (put this script in /etc/iot/scripts directory)
#
# How it works?
# a) Devices 1 sends a uplink payload to LPS8. LPS8 will get the DI1 and DI2 info from the payload
# b) LPS8 will send a message to Device 2 to set the Device2 DO1 = Device1 DI1, and Device DO2 = Device DI2.
# c) Device2 will change DO1 and DO2 to according to the message from LPS8, and send back a message to LPS8 with the its DO1
# and DO2 value. LPS8 will ask Device1 to change its DO1 to same as Device 2, and change the DO2 to the same as Device 2.
# ( The purpose of this step is to show that the Device2 has already do the change there).
#
# For example: If current status of Device1 and Device2 leds shows:
# Device1: DI1: ON, DI2: ON , DO1: OFF, DO2: OFF
# Device2: DI1: OFF, DI2: OFF , DO1: OFF, DO2: OFF
#
# Step2 will cause below change:
# Device1: DI1: ON, DI2: ON , DO1: OFF, DO2: OFF
# Device2: DI1: OFF, DI2: OFF , DO1: ON, DO2: ON
#
# Step3 will cause below change:
# Device1: DI1: ON, DI2: ON , DO1: ON, DO2: ON
# Device2: DI1: OFF, DI2: OFF , DO1: ON, DO2: ON
# So if a person is in the Device 1 location, he can check if the DO LED match DI LEDs on Device 1 to confirm
# whether the Device 2 has been changed.