\ ********************************************************************* \ Communication with LoRa transmitter thru UART2 \ Filename: LoRaCommunication.txt \ Date: 10 jan 2022 \ Updated: 16 jan 2022 \ File Version: 1.0 \ MCU: ESP32-WROOM-32 \ Forth: ESP32forth all versions 7.x++ \ with Serial2 extension \ Copyright: Marc PETREMANN \ Author: Marc PETREMANN \ GNU General Public License \ ********************************************************************* \ require: ../strings.txt \ use modified version of ESP32Forth \ see ../serial2.txt - new words in Serial vocabulary: \ Serial2.flush \ Serial2.write \ Serial2.readBytes \ Serial2.available \ Serial2.end \ Serial2.begin \ Connection LoraTransmitter \ REYAX RYLR896 ESP32 ESP32Forth \ 1: VDD 3.3V --------------- VDD 3V3 \ 2: NRTS \ 3: RXD -------------------- G17 UART 2 TX \ 4: TXD -------------------- G16 UART 2 RX \ 5: NC \ 6: GND -------------------- GND DEFINED? --LoRa [if] forget --LoRa [then] create --LoRa \ 115200 speed communication for LoRa REYAX 115200 value #SERIAL2_RATE \ definition of OUTput and INput buffers 128 string LoRaTX \ buffer ESP32 -> LoRa transmitter 128 string LoRaRX \ buffer LoRa transmitter -> ESP32 Serial \ Select Serial vocabulary \ initialise Serial2 : Serial2.init ( -- ) #SERIAL2_RATE Serial2.begin ; \ Setup LoRa Frequency - only for example : .band8685 ( -- ) s" AT+BAND=868500000" LoRaTX $! $0d LoRaTX c+$! $0a LoRaTX c+$! \ add CR LF code at end of command LoRaTX Serial2.write drop ; \ input from LoRa transmitter : LoRaInput ( -- n ) Serial2.available dup if LoRaRX maxlen$ nip Serial2.readBytes LoRaRX drop cell - ! then ; \ Usage: \ Serial2.init \ .band8685 \ Serial2.available \ LoRaInput
Legal: site web personnel sans commerce / personal site without seling