• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Initializing Lora module

Q&A Forum › Category: ESP32 › Initializing Lora module
0 Vote Up Vote Down
David Doidge asked 4 years ago

Hi, I am only asking this question to help me understand my sketch (my lora is working great).
The code:
while (!LoRa.begin(866E6)) {
Serial.println(“.”);
delay(500); }
Says “If the lora module does not send a response on frequency 866 then print “.” and then wait half a second and try again”
But how is the lora module initialized (turned on) in the first place ?

Question Tags: LORA
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi David.

When it checks if LoRa is initialized, it is initializing the LoRa module at the same time. It needs to run the LoRa.begin(866) command first to check if its state is true or false.

You see this approach often to initialize sensors.

What you need to understand is that if you have the LoRa.begin() method, even if it has a ! or an if statement before it, it is already running the command.

So, here’s what it does:

  • runs LoRa.begin(866E6);
  • negation of the result of the previous command !LoRa.begin(866E6) –> if it initializes successfully returns true—with the negation becomes false; if it doesn’t initialize properly returns false—with the negation becomes true;
  • checks the state of !LoRa.begin(866E6). If it is true (it means it didn’t initialize properly), it will print the dots. If it is false (it means it initialized properly), it won’t run the if statement.

I hope this is clear.

Regards,
Sara

0 Vote Up Vote Down
David Doidge answered 4 years ago

Thank you Sara.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

I’ll mark this question as resolved.
If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.