Releases: open-electronics/LoRa
LoRa Library V 3.0
New class LoraNode for simpler network usage. (Please read warning below about old shield)
Principal functions
- Instance : LoraNode() ; with this format the node id is loaded from EEPROM, if it has been saved. Otherwise is 1 as default and in this case you can use setLoraNode(id), later , for setting it.
Or directly : LoraNode(node_number). - Radio module activation: begin(); if any problem with module returns “false”
- Send message: writeMessage(to,string,timeout); this function checks if air channel is busy (channel is defined by frequency,spreading factor, band width). If busy, it waits for “timeout” milliseconds at most. In case of timeout it returns “false” and it doesn't send message.
- Try to receive: newMessAvailable(timeout); if a message arrives before “timeout” millisecond it returns “true” else “false”, and message can be read using next functions. There is also a function format that waits just for a specific sender (newMessAvailable(sender,timeout);).
NB Default receiving message length is 64 bytes long (null terminated string of 64 char length) . If you need to send longer messages you have to use changeMessageBufferLen(int maxMesslen) function. - Read message text and others message features of packet just arrived:
- getMessage();
- getSender();
- getMarker();
In addition of basic functions there are also functions that allow us to overwrite default values and to save node id on EEPROM. It is possible to save, also, all network and radio parameters on EEPROM. All functions are explained inside help pages and are commented on library file “LoraNode.h”.
In order to complete description of particular features of library we have to include the function “setAutomaticAck(true/false)” that set on or set off a sort of automatic acknowledge (two char “AK”) . If on, library sends acknowledge at any reception, and library waits for acknowledge replay after any sending. Default is off.
We remark that radio module is half-duplex, so it can't receive while it transmits. Therefore the management of this traffic needs some planning to not loose messages.
LoraNode class is string message oriented, but if you need to send binary data you can use byte oriented version of writeMess() and newMessAvailable() function; see help pages, or LoraNode.h file.
Attention!
Because harware changing (old to new shield), library 3.0 can have some problem with old shield. In case you are still using old shield (N.B. new shield is recognizible because shorter), please download LORA30-update.zip and read Note.txt inside.
LoRa Library 2.2. Few upgrades and changes; support for micro remote control
Release note (compiled with IDE 1.8.1)
Version 2.2
New Functions in LORA :
- defDevRange() : define devices local addresses range in a network structure
- defNetAddress() : define the network address part of address structure
(NB. setNetAddress() is deprecated)
Redesign of receiveNetMess() : now manages local broadcast
Upgrade function LORA begin with some setting of parameter (default optimizing low speed and
setting parameters SF=11, BW=7, CR=4)
New Functions in SX1278: - SX.setRndSeed() : set the random number generator using Lora RSSI wideband noisy value
- SX.getLorabps() : returns computed bit/second (bps) depending on BW,SF and CR set
- SX.getLoraBwFreq() : returns Band Width in terms of frequency (getLoraBw istead returns code)
- SX.setLoraLowDataRateOptimize(boolean on): set register for optimize in case of low bps
- SX.lastLoraPacketSignalPower() : computed signal strength (RSSI+SNR)
LoRa library
The major purpose of this library is for implementing a LoRa (long range : hundred meters) network. So addresses and cryptography (AES256) is managed.
But also general SX1287 managing functions are included, as well as Class to command radio-controlled power socket (like Veleman and Avidsen).