You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To work with the library, first you must include `SX126x` header or `SX127x` header depending LoRa module you use. For LLCC68 include SX126x header. Then initialize class in the header by creating an object.
43
40
44
-
```C++
41
+
```c++
45
42
// for SX126x series or LLCC68
46
43
#include<SX126x.h>
47
44
SX126x LoRa;
@@ -53,7 +50,7 @@ SX127x LoRa;
53
50
54
51
Before calling any configuration methods, doing transmit or receive operation you must call `begin()` method. You can call `begin()` method inside Arduino `setup()` function.
55
52
56
-
```C++
53
+
```c++
57
54
voidsetup() {
58
55
LoRa.begin();
59
56
// configuration code goes here
@@ -89,15 +86,15 @@ The default Arduino pins used for connecting to SX126x and SX127x are as follows
89
86
### SPI Port Configuration
90
87
91
88
To change Arduino default SPI port or SPI frequency call `setSPI()` method before `begin()` method.
92
-
```C++
93
-
LoRa.setSPI(SPI2, F_CPU/2);
89
+
```c++
90
+
LoRa.setSPI(SPI2, 16000000);
94
91
LoRa.begin();
95
92
```
96
93
97
94
### I/O Pins Configuration
98
95
99
96
To configure I/O pins (NSS, RESET, BUSY, IRQ, TXEN, RXEN pin) call `setPins()` before `begin()` method.
100
-
```C++
97
+
```c++
101
98
// set NSS->10, RESET->9, BUSY->4, DIO1->2, TXEN->8, RXEN->7 for SX126x series
102
99
LoRa.setPins(10, 9, 2, 4, 8, 7);
103
100
// set NSS->10, RESET->9, DIO0->2, TXEN->8, RXEN->7 for SX127x series
@@ -111,7 +108,7 @@ Before transmit or receive operation you can configure transmit power and receiv
111
108
112
109
### Transmit Power
113
110
114
-
```C++
111
+
```c++
115
112
// set transmit power to +22 dBm for SX1262
116
113
LoRa.setTxPower(22, SX126X_TX_POWER_SX1262);
117
114
// set transmit power to +20 dBm for SX127x series using boost pin
// Set syncronize word for public network (0x3444)
155
152
LoRa.setSyncWord(0x3444);
156
153
```
@@ -159,7 +156,7 @@ LoRa.setSyncWord(0x3444);
159
156
160
157
Transmit operation begin with calling `beginPacket()` method following by `write()` method to write package to be tansmitted and ended with calling `endPacket()` method. For example, to transmit "HeLoRa World!" message and an increment counter you can use following code.
161
158
162
-
```C++
159
+
```c++
163
160
// message and counter to transmit
164
161
char message[] = "HeLoRa World!";
165
162
uint8_t counter = 0;
@@ -177,7 +174,7 @@ For more detail about transmit operation, please visit this [link](https://githu
177
174
178
175
Receive operation begin with calling `request()` method following by `read()` method to read received package. `available()` method can be used to get length of remaining package. For example, to receive message and a counter in last byte you can use following code.
179
176
180
-
```C++
177
+
```c++
181
178
LoRa.request();
182
179
LoRa.wait();
183
180
@@ -197,10 +194,6 @@ For more detail about receive operation, please visit this [link](https://github
197
194
198
195
See examples for [SX126x](https://github.com/chandrawi/LoRaRF-Arduino/tree/main/examples/SX126x), [SX127x](https://github.com/chandrawi/LoRaRF-Arduino/tree/main/examples/SX127x), and [simple network implementation](https://github.com/chandrawi/LoRaRF-Arduino/tree/main/examples/Network).
199
196
200
-
## License
201
-
202
-
This library published under [MIT license](https://github.com/chandrawi/LoRaRF-Arduino/blob/main/LICENSE).
0 commit comments