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
Copy file name to clipboardExpand all lines: content/hardware/09.kits/maker/nesso-n1/tutorials/user-manual/content.md
+81-4Lines changed: 81 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -293,7 +293,7 @@ The Nesso N1 features a 1.14-inch IPS color touchscreen with a resolution of 135
293
293
-**Display Controller**: ST7789, controlled via SPI.
294
294
-**Touch Controller**: FT6336U, controlled via I2C.
295
295
296
-
The display can be programmed using the **M5GFX** library, which can be installed using the Arduino IDE Library Manager.
296
+
The display can be programmed using the [**M5GFX**](https://github.com/m5stack/M5GFX) library, which can be installed using the Arduino IDE Library Manager.
297
297
298
298
Here is an example to display touch input as text on the screen:
299
299
@@ -369,17 +369,27 @@ The LoRa® module is controlled via SPI and several dedicated pins on both the E
369
369
|`LORA_ANTENNA_SWITCH`|| E0.P6 | LoRa® RF Antenna Switch Control |
Here is a simple example to send a LoRa® packet using the [RadioLib](https://github.com/jgromes/RadioLib) library:
372
+
#### LoRa® Transmitter Example
373
+
374
+
Here is a simple example to send a "Hello World!" packet every five seconds using [RadioLib](https://github.com/jgromes/RadioLib) library.
373
375
374
376
```arduino
375
377
#include <RadioLib.h>
376
378
377
-
// Create an SX1262 radio object
378
-
SX1262 radio = new Module(LORA_CS, LORA_IRQ, LORA_ENABLE, LORA_BUSY);
379
+
// Initialize the radio module, passing RADIOLIB_NC for the reset pin.
380
+
// The reset will be handled manually.
381
+
SX1262 radio = new Module(LORA_CS, LORA_IRQ, RADIOLIB_NC, LORA_BUSY);
379
382
380
383
void setup() {
381
384
Serial.begin(115200);
382
385
386
+
// Manually reset the LoRa module using the expander pin for reliability.
387
+
pinMode(LORA_ENABLE, OUTPUT);
388
+
digitalWrite(LORA_ENABLE, LOW);
389
+
delay(10);
390
+
digitalWrite(LORA_ENABLE, HIGH);
391
+
delay(10);
392
+
383
393
// Initialize the LoRa® module
384
394
// Frequency: 915.0 MHz
385
395
int state = radio.begin(915.0);
@@ -407,6 +417,73 @@ void loop() {
407
417
}
408
418
```
409
419
420
+
421
+
#### LoRa® Receiver Example
422
+
423
+
This example listens for packets and prints them to the Serial Monitor. It uses a simple polling method where the main loop waits until a packet is received. Upload this code to a second Nesso N1 to receive messages from the transmitter.
424
+
425
+
```arduino
426
+
#include <RadioLib.h>
427
+
428
+
// Initialize the radio module, passing RADIOLIB_NC for the reset pin.
429
+
SX1262 radio = new Module(LORA_CS, LORA_IRQ, RADIOLIB_NC, LORA_BUSY);
430
+
431
+
void setup() {
432
+
Serial.begin(115200);
433
+
434
+
// Manually reset the LoRa module.
435
+
pinMode(LORA_ENABLE, OUTPUT);
436
+
digitalWrite(LORA_ENABLE, LOW);
437
+
delay(10);
438
+
digitalWrite(LORA_ENABLE, HIGH);
439
+
delay(10);
440
+
441
+
// Initialize the LoRa® module.
442
+
int state = radio.begin(915.0);
443
+
if (state != RADIOLIB_ERR_NONE) {
444
+
Serial.print(F("failed, code "));
445
+
Serial.println(state);
446
+
while (true);
447
+
}
448
+
449
+
// Start listening for LoRa packets.
450
+
Serial.print(F("[SX1262] Starting to listen... "));
451
+
state = radio.startReceive();
452
+
if (state != RADIOLIB_ERR_NONE) {
453
+
Serial.print(F("failed, code "));
454
+
Serial.println(state);
455
+
while (true);
456
+
}
457
+
}
458
+
459
+
void loop() {
460
+
// Check if a packet is available.
461
+
int state = radio.readData(str);
462
+
463
+
if (state == RADIOLIB_ERR_NONE) {
464
+
// Packet was received successfully.
465
+
Serial.print(F("[SX1262] Received packet: "));
466
+
Serial.println(str);
467
+
468
+
// Print packet statistics.
469
+
Serial.print(F("[SX1262] RSSI: "));
470
+
Serial.print(radio.getRSSI());
471
+
Serial.print(F(" dBm, SNR: "));
472
+
Serial.print(radio.getSNR());
473
+
Serial.println(F(" dB"));
474
+
475
+
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
476
+
Serial.println(F("[SX1262] CRC error!"));
477
+
} else if (state != RADIOLIB_ERR_RX_TIMEOUT) {
478
+
// Some other error occurred. Timeout is expected and ignored.
479
+
Serial.print(F("[SX1262] Failed, code "));
480
+
Serial.println(state);
481
+
}
482
+
}
483
+
```
484
+
485
+
***Please note: because the `LORA_ENABLE` pin is on an I/O expander, it cannot be passed directly to the RadioLib library constructor. The library must be initialized with the reset pin set to `RADIOLIB_NC` and is best practice to perform a manual reset in setup.***
0 commit comments