|
1 | 1 | # API Reference
|
2 | 2 |
|
3 |
| -The `TheThingsNetwork` class enables Arduino devices with supported LoRa modules to communicate via The Things Network. |
| 3 | +The `TheThingsNetwork` class enables Arduino devices with supported LoRaWAN modules to communicate via The Things Network. Currently supported LoRaWAN modules are the Microchip RN2483 and the RN2903. |
4 | 4 |
|
5 | 5 | ## Class: `TheThingsNetwork`
|
6 | 6 |
|
7 |
| -Include and instantiate the TheThingsNetwork class. The constructor initialize the library with the Streams it should communicate with. It also sets the value of the spreading factor, the front-side Bus and the frequency plan. |
| 7 | +Include and instantiate the TheThingsNetwork class. The constructor initialize the library with the Streams it should communicate with. It also sets the value of the spreading factor, the frequency plan and the frequency sub-band. |
8 | 8 |
|
9 | 9 | ```c
|
10 | 10 | #include <TheThingsNetwork.h>
|
11 | 11 |
|
12 | 12 | TheThingsNetwork ttn(Stream& modemStream, Stream& debugStream, fp_ttn_t fp, uint8_t sf = 7, uint8_t fsb = 2);
|
13 | 13 | ```
|
14 | 14 |
|
15 |
| -- `Stream& modemStream`: Stream for the LoRa modem (for The Things Node/Uno use `Serial1` and data rate `57600`). |
16 |
| -- `Stream& debugStream`: Stream to write debug logs to (for The Things Node/Uno use `Serial` and data rate `9600`). |
| 15 | +- `Stream& modemStream`: Stream for the LoRa modem ([see notes](https://www.thethingsnetwork.org/docs/devices/arduino/usage.html)). |
| 16 | +- `Stream& debugStream`: Stream to write debug logs to ([see notes](https://www.thethingsnetwork.org/docs/devices/arduino/usage.html)). |
17 | 17 | - `fp_ttn_fp fp`: The frequency plan: `TTN_FP_EU868`, `TTN_FP_US915`, `TTN_FP_AS920_923`, `TTN_FP_AS923_925` or `TTN_FP_KR920_923` depending on the region you deploy in. See [the wiki](https://www.thethingsnetwork.org/wiki/LoRaWAN/Frequencies/Frequency-Plans).
|
18 | 18 | - `uint8_t sf = 7`: Optional custom spreading factor. Can be `7` to `10` for `TTN_FP_US915` and `7` to `12` for other frequency plans. Defaults to `7`.
|
19 | 19 | - `uint8_t fsb = 2`: Optional custom frequency subband. Can be `1` to `8`. Defaults to `2` (for US915).
|
@@ -61,7 +61,6 @@ Band: 868
|
61 | 61 | Data Rate: 5
|
62 | 62 | RX Delay 1: 1000
|
63 | 63 | RX Delay 2: 2000
|
64 |
| -Total airtime: 0.00 s |
65 | 64 | ```
|
66 | 65 |
|
67 | 66 | See the [DeviceInfo](https://github.com/TheThingsNetwork/arduino-device-lib/blob/master/examples/DeviceInfo/DeviceInfo.ino) example.
|
@@ -140,8 +139,6 @@ Returns a success or error code and logs the related error message:
|
140 | 139 |
|
141 | 140 | See the [Send](https://github.com/TheThingsNetwork/arduino-device-lib/blob/master/examples/Send/Send.ino) example.
|
142 | 141 |
|
143 |
| -Also in sendBytes, due to TTN's 30 second fair access policy, we update the airtime each time we uplink a message. This airtime is based on a lot of variables but the most important ones are the spreading factor and the size of the message, the higher it is the less messages you can send in 30 seconds (SF7 around 500 messages of 8 bytes, SF12 around 20 messages of 8 bytes). |
144 |
| - |
145 | 142 | ## Method: `poll`
|
146 | 143 |
|
147 | 144 | Calls `sendBytes()` with `{ 0x00 }` as payload to poll for incoming messages.
|
|
0 commit comments